So what i am trying to do is minimize the files needed for callbacks in flex. I have a login page where i authenticate the user using
FlexGlobals.topLevelApplication.userService.authenticate(usernameInput.text, passInput.text, new BasicCallback());
The BasicCallback() implements App42CallBack with onSuccess and onException.
In the onSuccess function, i am tryint to dispatch a custom event without any lack.
public function onSuccess(response:Object):void
var user:User = User(response);
trace("response is : " + user);
var dispatcher:EventDispatcher = new EventDispatcher();
dispatcher.dispatchEvent( new ResponseEvent( ResponseEvent.DATA_LOADED, true, false, response ) );
Can someone help?
Is there a way to move the BasicCallback in my mxml file?
After a lot of try and error, my team and I managed to find a good enough solution.
1st, we created a custom event which is able to not only return event hits (complete, failed,etc) but also parameters.
Then we extended any callback like the following:
public class BasicCallback extends EventDispatcher implements App42CallBack
This way we are able to dispatch an event during the onSuccess call returning the needed data to the mxml file.
This is great to use in mxml flex mobile apps.