Event.complete getting delayed in my for loop

hey all,

I’ve run into something which i’ve been stuck on for weeks, and i’m finally breaking down, i need a little assistance. I have a for loop of some xml that i’m parsing, and inside that for loop are one of two things. 1. an xml node that i push into an array or 2. a link to another xml file that has that node i need to push.

This is where the problem comes in, because if i have three nodes in that xml 1. a node that I push into my array, 2. a link to an xml that has that node, and 3. another node that i push into my array, the for loop will not stop and wait for the Event.COMPLETE to happen, it turns into a race condition, and the third node may end up getting pushed into the number two spot depending on how long it takes the Event.COMPLETE to happen.

With all that said, is there a way to stop/pause the for loop to wait for an Event.COMPLETE event to happen?