Skip navigation
Currently Being Moderated

Waiting for multiple independent asynchronous events during startup

Oct 21, 2010 6:01 AM

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)]

        public static function 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?

 

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points