views:

157

answers:

0

I'm trying to test some async functionality in flex 4. My test has two stages :

var loader:MySuperLoader = new MySuperLoader()
loader.load('foo.swf');
loader.addEventListener(Event.COMPLETE, Async.asyncHandler(this, function(e:Event):void {
    loader.removeEventListener(Event.COMPLETE, arguments.callee);
    var foo:* = loader.content;
    loader.load('bar.swf');
    loader.addEventListener(Event.COMPLETE, Async.asyncHandler(this, function(e:Event):void { 
        /* This call to asyncHandler generates the error */ 
    }, 5000));
}, 5000));

The second call to asyncHandler generates an error saying :

Error: Cannot add asynchronous functionality to methods defined by Test,Before or After that are not marked async

Is there a way to test such functionality?