I am trying to send some variables to an ASP cgi using the sendAndLoad() function in Flash. On Frame one of my movie I have the following code:
// on submit function
function onSubmit() {
// Initialize form variables:
query = new LoadVars();
// Get combo box selections:
query.propertyId = 33;
query.adultCount = 2;
query.childCount = 0;
query.infantCount = 0;
query.roomCount = 1;
query.arriveDate = "22/08/2005";
query.departDate = "24/08/2005";
// Change the URL to point to the ASP file on your web server.
query.sendAndLoad("[http://84.92.195.220/LodgeXMLTest/xmlquery.aspx](http://84.92.195.220/LodgeXMLTest/xmlquery.aspx)", query, "POST");
// goto next frame
nextFrame();
}
// send form data
_root.onSubmit();
This is trying to replicate the HTML version you can see here:
http://dev.studio24.net/contractor/xmltest.htm
This as you can see returns some XML data which I need to be able to trace. Once I have successfully done that I will then apply it to some movie clips.
On Frame 2 of my movie I have this code:
//Calculates bytes loaded and total bytes in an enterFrame loop
_root.onEnterFrame = function() {
totalBytes = query.getBytesTotal();
loadedBytes = query.getBytesLoaded();
if (totalBytes == loadedBytes) {
trace(loadedBytes+" "+totalBytes);
nextFrame();
delete _root.onEnterFrame;
}
};
and on Frame 3 I need to trace the returned XML data printed by the ASP cgi, so I have done this:
// load XML results
menuXml = new XML();
menuXml.ignoreWhite = true;
menuXml.onLoad = function(success) {
if (success) {
menuItem = this.childNodes;
for (var i = 0; i<menuItem.length; i++) {
trace(menuItem*.firstChild.attributes.roomTypeCustomerTitle);
}
}
};
Now, I know all the names of variables and new XML etc are wrong but my actionScript is lame so I’m stuck on what I need to do to fix it. As you saw before the HTML version works so I just need to replicate this in Flash.
Can anyone tell me what I am doing wrong and how to correct this.
Much aopreciated
Cheers
Dave