Flex dispatch events from API42

0 votes

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?

Thank you


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.

asked Oct 22, 2015 in App42 DevOps by leossmith (15 points)
edited Oct 24, 2015 by leossmith

1 Answer

0 votes

Hello Leo,

Please have  a look at this link and let us know if it helps. 



Himanshu Sharma

answered Oct 23, 2015 by hs00105 (2,005 points)
Thank you for your answer. This really helped but we managed to come with another helpfull solution too. So i am editing my own question :)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com