Flash: How to get a list to be processed synchronous instead of asynchronous?

Posted by Quandary on Stack Overflow See other posts from Stack Overflow or by Quandary
Published on 2010-05-18T15:26:38Z Indexed on 2010/05/18 15:40 UTC
Read the original article Hit count: 159

Filed under:
|
|
|
|

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...

© Stack Overflow or respective owner

Related posts about as3

Related posts about actionscript