3 Replies Latest reply on Sep 11, 2012 9:17 PM by Yuvayu

    Data Retrieve Issue

    Yuvayu Level 1

      Hi

       

      For my last post I haven't got any reply I think no one got my issue.

      So I am posting exactly what I am doing and what I am getting.

      Expecting some solution from someone.

       

      In my views package I have LoginForm.mxml

      Here I am dispatching the event the method I have used goes like this.

       

      /******************************************************/

       

      [Bindable]

      public var user:User;

       

      private function checkUser():void{

                     

          var uId:Number = 4;

          user.userId = uId;

          var event:UserEvent = new UserEvent(UserEvent.LOGIN);

          event.userId = uId;

          dispatchEvent(event);

      }

       

      /******************************************************/

       

       

       

       

      My User.as contains

       

      /******************************************************/

       

      [Bindable]

      public class User

      {

          public var userId:Number;

          public var userName:String;

          public var userPhone:String;

          public var userGuest:int;

          public var userDate:String;

          public var userTime:String;

      }

       

      /******************************************************/

       

       

       

       

      My UserEvent.as contains

      /******************************************************/

      public class UserEvent extends Event

      {

          public static const LOGIN:String = "login";

         

          [Bindable]

          public var user:User;

         

          public var userId:Number;

          public var userName:String;

          public var userPhone:String;

          public var userGuest:Number;

          public var userDate:String;

          public var userTime:String;

         

          public function UserEvent(type:String)

          {

              super(type,true);

          }

      }

       

      /******************************************************/

       

       

       

       

       

      In my maps package I have MainEventMap.mxml, which contain.

       

      /******************************************************/

       

      <fx:Declarations>

          <!-- Place non-visual elements (e.g., services, value objects) here -->

          <ns:Debugger level="{Debugger.ALL}" />

             

          <ns:EventHandlers type="{UserEvent.LOGIN}" debug="true">

             

              <ns:WebServiceInvoker wsdl="MY URL?WSDL"

                        method="GetUserProfile"

                        arguments="{[4]}"

                        debug="true">

                 

                  <ns:resultHandlers>

                      <ns:CallBack method="handleUser" arguments="{resultObject}" />

                  </ns:resultHandlers>

                  <ns:faultHandlers>

                      <ns:CallBack method="handleFault" arguments="{fault.faultDetail}" />

                  </ns:faultHandlers>

              </ns:WebServiceInvoker>

          </ns:EventHandlers>

             

          <ns:Injectors target="{LoginForm}">

              <ns:PropertyInjector targetKey="user" source="{User}" />

          </ns:Injectors>

      </fx:Declarations>

       

      /******************************************************/

       

      MY URL result file contain method "GetUserProfile" to which I am passing argument "4" as "Number".

      And I am getting the output as.

      /******************************************************/

       

      <NewDataSet>

          <userProfile>

              <UserId>4</UserId>

              <UserDetailId>4</UserDetailId>

              <UserName>ravi</UserName>

              <EmailId>ravi@example.com</EmailId>

              <FirstName>ravi</FirstName>

              <Occupation>Flex Developer</Occupation>

              <Country>India</Country>

              <State>Andhra Pradesh</State>

              <City>Vijayawada</City>

              <MobileNumber>+9100000000</MobileNumber>

              <LandLine>111111111</LandLine>

          </userProfile>

      </NewDataSet>

       

      /******************************************************/

       

       

      In the "handleUser" method which is in LoginForm.mxml I wrote

      /******************************************************/

       

      public function handleUser(returnText:Object):void

      {

          for(var i in returnText){

              Alert.show(i);

          }

      }

       

      /******************************************************/

       

       

      I am trying to alert the result I am geeting.

      /******************************************************/

       

      NewDataSet

       

      /******************************************************/

       

      Please help me to get out of this.

      Thank you.

        • 1. Re: Data Retrieve Issue
          John Hall Level 4

          A couple questions. Did you include an instance of the map in the main application? I would expect something like:

           

          <ns:MainEventMap /> to make sure the map is instantiated and the global dispatcher is created.

           

          With Mate, I'd be sure to bubble any custom events. Something like

           

          public function UserEvent( type : String, bubbles : Boolean = true, cancelable : Boolean = false ) {

                                        super( type, bubbles, cancelable );

                              }

           

           

                              override public function clone () : Event {

                                        return new UserEvent( type );

                              }

          • 2. Re: Data Retrieve Issue
            John Hall Level 4

            Whoops. Looks like you do have bubbles turned on. How about the instance of the mainEventMap at toplevel?

            • 3. Re: Data Retrieve Issue
              Yuvayu Level 1

              Thank you John for giving your time to my issue.

              Yes I do have added map instance in main application as,

               

              <fx:Declarations>

                   <!-- Place non-visual elements (e.g., services, value objects) here -->

                   <maps:MainEventMap />

              </fx:Declarations>

               

              And to my custom event I did change like,

               

              public function UserEvent( type : String, bubbles : Boolean = true, cancelable : Boolean = false )

              {

                    super( type, bubbles, cancelable );

              }

               

              I have tried to alert the result but I am getting the same thing,

               

              NewDataSet

               

              If you can provide me any running example related to my issue then I will be very thankful to you.

              Please mail me to paragbansod@yuvayu.com

              And if you want to see what exactly what I have done with the code I can send the files.

              It will be helpful because I am working on MATE first time and dnt have much idea about it.

              Thank you once again.