Hello,

I have a for loop like (pseudocode);

for (var i:int=0; i < 10; i++) 
{
        callJava.method(i);
        callJava.addEventListener("result", finalMethod);

        if (finallMethod) == "VAL: 1"; //validation failled, break the loop
}

private function finalMethod(e:ResultEvent):String
{
   return "VAL: " + e.currentTarget.lastResult;
}

The loop is called to validate rows in a datagrid. I am fetching each row and 
the performing a check using a Java method, if the test passes, I need to 
continue to take the next row and so on. There is no point to waste time on 
looping thru 10 rows if the validation falls on the first row and so on. 

How can I handle this case in flex, as my call/result is asynchronous and I 
will get it few milliseconds later, by the time I get the result for the first 
value my loop will already have completed.

All help is appropriated.
Thanx,
Adnan

Reply via email to