Skip navigation
Currently Being Moderated

Data Retrieve Issue

Aug 27, 2012 10:34 PM

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.

 
Replies
  • Currently Being Moderated
    Aug 28, 2012 6:16 AM   in reply to Yuvayu

    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 );

                        }

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 28, 2012 6:24 AM   in reply to John Hall

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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points