Flash: How to get a list to be processed synchronous instead of asynchronous?
- by Quandary
Question: In Flash I have the below function.
Now the problem is SaveFurniture, SavePolygons and SaveComments all save to the same XML file. Now SaveFurniture sends JSON encoded data to a ashx handler, which saves it in the xml on the server. The problem is, because flash sends the data asynchronous, the polygons get sent to the polygonsave ashx handler, but before saving of the furniture has completed, thus access error, write process already in progress...
// cSaveData.SaveData();
public static function SaveData():void
{
trace("cSaveData.SaveData");
//NotifyASPXofNewScale(cGlobals.nPlanScale);
SaveFurniture();
SavePolygons();
SaveComments();
}
What's the best way to process this list, ONE AFTER ANOTHER ?
Making a callback in all of them does make the program flow structure very confusing...