Actionscript login() result is ObjectProxy, not BackendlessUser

When receiving the user result for the login() method, it’s typed as an ObjectProxy. Trying to cast it to a BackendlessUser type makes it null.

Hi Devin,

Here’s the code I just tried and it works for me just fine:

responder = new Responder( function( userEvent:ResultEvent ):void
trace( "got user" );
var backendlessUser:BackendlessUser = userEvent.result as BackendlessUser;
trace( backendlessUser.getProperty( "email" ) );
function( evt:FaultEvent ):void
trace( "got error" );
Backendless.UserService.login( myLoginName, myPassword, responder );

How different is your code?


I’m utilizing the returned asynctoken with the parsley framework. I’ll play with it a bit more tomorrow and let you know what I find. Thanks Mark.

[reply user_id=1][h4]Hi Mark,[/h4]

When specify a responder as an argument in the service call (as you did with your code), it works fine; I do get a BackendlessUser returned. It’s only when adding a responder to the resulting AsyncToken that an ObjectProxy is returned instead of a BackendlessUser

var token:AsyncToken = Backendless.UserService.login(email, password);token.addResponder(new Responder(loginResult, loginFault));[/reply]

Hi Devin,

You’re correct, if you add a responder to async token, it will not cast automatically. Here’s the reason: take a look at the lines 110-112 here:

As you can see, we build a user object from the event we get from the server using the following call:

_currentUser = ObjectsBuilder.buildUser(event.result);

Setting the user token on line 112 is also quite important. The token is used to maintain the user session. I recommend duplicating these lines in your responder which you add directly to async token.


Thanks Mark, that works. I also found found this solution, from the user-service-parsley example, to be a pretty clean way of handling it:

    public function result(user:Object):void
    {"Login success");


        dispatcher(new NavigateToMessage(Destination.LOGGEDIN));