Created
December 14, 2010 19:10
-
-
Save benbjohnson/740901 to your computer and use it in GitHub Desktop.
Async Callback Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function shouldTestCallbackMethod():void | |
{ | |
// Create a dispatcher that lives outside your callback | |
var dispatcher:EventDispatcher = new EventDispatcher(); | |
// Create your callback mock function which dispatches the event | |
var func:Function = function():void{ | |
dispatcher.dispatchEvent(new Event(Event.COMPLETE)); | |
} | |
// Set the FlexUnit condition to wait for the dispatcher | |
Async.proceedOnEvent(this, dispatcher, Event.COMPLETE); | |
// Assign callback and run code | |
myObj.callback = func; | |
myObj.execute(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment