PDA

View Full Version : Database Help.


maasss18
11-12-2008, 10:30 AM
Hi! I have a question regarding database and sequence flow.

This is my code:
private function resultGetRelationships(event:ResultEvent):void{
testArea1._linkCollection.removeAll();
for each(var rShipId:int in ModelDbService2.getRelationships.lastResult){
var MDrShipID:ModelDb=new ModelDb();
MDrShipID.rShipID = rShipId;
ModelDbService.getRShipTest(MDrShipID); <---- getting result from database
trace("for each first");
}

testArea1.addChildrenLink(); <---- is a function.
}


When i run, this is what i get on the console:
for each first
aaa2 <------- this is trace in method testArea1.addChildrenLink();
aaa2 <------- this is trace in method testArea1.addChildrenLink();
linkCollection1 <------ this is trace in method ModelDbService.getRShipTest(MDrShipID);

The problem is now before it finish to do the database, it will already started doing the function. Is there any setting so that the sequence flow won't be effected.

rawmantick
11-12-2008, 11:08 AM
Here you go
http://www.actionscript.org/forums/showthread.php3?t=157951

Peter Cowling
11-12-2008, 10:03 PM
Hi,

The problem seems to be that you are calling your server code and trying to handle the result in one function - rather than two.

You need to split the two parts up - making the call, and setting and event listener in the first function; and handling the result in the second.

Try to find an example for your particular server technology where they show how to do this.