This content has been marked as final. Show 4 replies
You need to use the method sendAndLoad in order to do that, and yes you will need an event handler to be able to detect when the data is sent back and loaded in your listener LodVars object. Just check "sendAndLoad" in the help file of Flash 8 it should put you on the good track.
THX for your reply. So far I did all that. I know how to send values to server side script (SSS). I know how to recieve and load xml into flash. The problem is I don't know how to combine those two actions. I have one main swf into which all others are loaded. This main swf sends values to SSS and new loaded swf loads the xml, created by SSS. The problem is the XML doesn't get loaded. In loaded swf I use a standard XML actions (creating a xml object, onLoad function, etc.). Is there an event handler, listener, which checks when the SSS prepares the XML and sends it to Flash?
Yeah, it's the sendAndLoad method of a loadVars object. This method both sends and receives data from a server-side script. It can even load that data directly into an XML object. I know you didn't ask for code, but it's the easiest way to illustrate.
// Create your XML and loadVars objects
var senderObj:loadVars = new loadVars();
var _xml:XML = new XML();
//Set the values of the variables you want to send as properties of loadVars
senderObj.Variable1 = Value1;
senderObj.Variable2 = Value2;
senderObj.Variable3 = Value3;
//Now send and receive data, using _xml as target
senderObj.sendAndLoad(_url_of_script, _xml, "POST");
At this point, the XML sent by the SSS is stored in the _xml variable. You can setup an .onLoad event handler for senderObj to pass that data to your other SWF - it triggers once the data has been received and verified (in this case, as XML, since it's trying to put it in an XML object).
RemyR, THX for your reply. One more question. If I have a XML object in loaded swf, then the target to xml in sendAndLoad should be mc._xml? I did try something like you suggested but I always did get the unsuccessful onLoad function result. I send values from main swf and load it into loaded swf. Can I send/show you the code for inspection?THX again