I am trying to send some variables to an ASP cgi using the sendAndLoad() function in Flash. On Frame 1 of my movie I have the following code:
// on submit function
function onSubmit() {
// Initialize form variables:
formData = new LoadVars();
// Get combo box selections:
formData.propertyId = 33;
formData.adultCount = 2;
formData.childCount = 0;
formData.infantCount = 0;
formData.roomCount = 1;
formData.arriveDate = "23/08/2005";
formData.departDate = "25/08/2005";
// Change the URL to point to the ASP file on your web server.
formData.sendAndLoad("[http://84.92.195.220/LodgeXMLTest/xmlquery.aspx](http://84.92.195.220/LodgeXMLTest/xmlquery.aspx)", formData, "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 = formData.getBytesTotal();
loadedBytes = formData.getBytesLoaded();
if (totalBytes == loadedBytes) {
trace(loadedBytes+" "+totalBytes);
trace(returnData);
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
returnData = new XML();
returnData.ignoreWhite = true;
inventoryHeader = this.childNodes;
for (var i = 0; i<inventoryHeader.length; i++) {
trace(inventoryHeader*.firstChild.attributes.roomRateCustomerTitle);
trace(inventoryHeader*.firstChild.attributes.roomTypeCustomerTitle);
}
inventoryItem = this.childNodes;
for (var i = 0; i<inventoryItem.length; i++) {
trace(inventoryItem*.firstChild.attributes.InventoryDate);
trace(inventoryItem*.firstChild.attributes.RatePlanID);
trace(inventoryItem*.firstChild.attributes.RoomCost);
}
Can anyone tell me what I am doing wrong and how to correct this?
Much aopreciated
Cheers
Dave