# FLash MX 2004 sendAndLoad() help!

**URL:** https://forum.kirupa.com/t/flash-mx-2004-sendandload-help/160080
**Category:** flash
**Created:** [August 23, 2005, 7:58am UTC](https://forum.kirupa.com/t/flash-mx-2004-sendandload-help/160080 "2005-08-23T07:58:29Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![daveyboy808](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@daveyboy808](https://forum.kirupa.com/u/daveyboy808)
#### Post date: [August 23, 2005, 7:58am UTC](https://forum.kirupa.com/t/flash-mx-2004-sendandload-help/160080/1 "2005-08-23T07:58:29Z")

</div>

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:

```auto

// 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](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:

```auto

//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:

```auto

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