Skip navigation
Currently Being Moderated

CallResponder works in MXML but not actionscript

Aug 17, 2012 3:15 PM

I am working on a Flex/PHP app and when Flashbuilder auto-generates MXML code it looks like this:

 

<s:CallResponder id="getUsersResult"
                         result="appModel.user = getUsersResult.lastResult[0] as User"/>
<userservice:UserService id="userService"
            fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
            showBusyCursor="true"/>

and it calls this function:

 

getUsersResult.token = userService.getUsers();

 

and everything works.

 

I want to be able to convert that all to Actionscript. When I do I have something like this:

 

public var userService:UserService;
public var responder:CallResponder;

 

public function init():void{
     
     userService = new UserService();
     responder = new CallResponder();
     responder.addEventListener(ResultEvent.RESULT, result);
     responder.addEventListener(FaultEvent.FAULT, fault); 
     responder.token = userService.getUsers();
}

protected function result(evt:ResultEvent):void{
                trace(responder.lastResult);
 }

 

It returns a User object, but all the values are null? What am I doing wrong?

 
Replies

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