Flex eventhandler mode

This weekend, I have a problem with Flex, to say specifically, with Flex's Event Handle mode.

Here is my situation, I need loop through SP500 symbols, and send the url to Yahoo web site to get some data.

When I sent a query, it will take some time to get the data back, the way Flex handles this is using Event Handler. It will add a listener to URLStream object, which will listen to complete event. When the stream is done loading, URLStream will be notified, and will proceed to do something else, like put the stream into database.

Now I got problems at the hand. You see, sending query and loading stream is separated, they are not in liner relationship. What will happen is you will send 500 queries to Yahoo server, then you wait for the data coming back to you one by one, not necessarily in the sending order.

First problem is, because I send the 500 queries together, Yahoo decides not like it, and I will get some timeout error.

Second problem is, when the data comes back, I need know the data is for which symbol, so I need pass the symbol to the complete event handler, fortunately, I found some solution:

urlStream.addEventListener(Event.COMPLETE, function(e:Event):void{loadedEventHandler(e, symbol);});

You see, that let me pass symbol to complete event handler.

addEventLister's signiture is (Event.COMPLETE, eventHandlerFunctionName:String)

But the eventHandlerFunction has to be like functionName(e:Event), so my own's event handler doesn't qualify the signature.

what this does, add a more standard event handler above my own event handler, then call my own event handler.

This resolve the problem, but the first problem is hard to resolve, eventually, I have to use Java to do what I want to do.