Quantcast
Channel: Adobe Community : Popular Discussions - FlexUnit
Viewing all articles
Browse latest Browse all 25673

Waiting for multiple independent asynchronous events during startup

$
0
0

I recently found myself needing to load two external files during the setup phase of a test. Normally I'd use Async.proceedOnEvent() with something like:

 

        [BeforeClass(async)]

        publicstaticfunction setUpBeforeClass():void

        {

            _oneRecord = new URLLoader(new URLRequest("data/OneRecord.csv"));

            Async.proceedOnEvent(ZeoCSVParserTest, _oneRecord, Event.COMPLETE);

            // Trying to load the second file causes problems

            // _complexRecord = new URLLoader(new URLRequest("data/ComplexRecord.csv"));

            // Async.proceedOnEvent(ZeoCSVParserTest, _complexRecord, Event.COMPLETE);

        }

 

In this case adding a second Async.proceedOnEvent() doesn't work. I ended up creating an event aggregator class to handle waiting for the needed events. I was curious if there was a facility already built in that would handle this?

 


Viewing all articles
Browse latest Browse all 25673

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>