3 Replies Latest reply on Aug 18, 2012 10:35 PM by Flex harUI

    CallResponder works in MXML but not actionscript

    iamcootis Level 1

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

      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{


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