# Loading XML in Flash through ASP variable

**URL:** <https://forum.kirupa.com/t/loading-xml-in-flash-through-asp-variable/204933>\
**Category:** flash\
**Created:** [October 24, 2006, 7:09pm UTC](https://forum.kirupa.com/t/loading-xml-in-flash-through-asp-variable/204933 "2006-10-24T19:09:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bonzomn](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@bonzomn](https://forum.kirupa.com/u/bonzomn)\
**Post date:** [October 24, 2006, 7:09pm UTC](https://forum.kirupa.com/t/loading-xml-in-flash-through-asp-variable/204933/1 "2006-10-24T19:09:04Z")

</div>

I’m working on an eCard application and I need to load XML into dynamic text fields in a Flash swf. The problem I’m having is I need to pass a variable (which names the XML file) from ASP into Flash. The ASP code needs to find the XML file and then pass that variable into Flash so it can load the XML data. In my source code below I list the variable “XMLsourceFile” but it’s referring to a static xml document, not a variable passed from ASP.

Any help would be very appreciated. Thanks in advance!!

// grab the XML data to populate the flash card  
XMLsourceFile = “xml\_output.xml”;  
content\_xml = new XML();  
content\_xml.ignoreWhite = true;  
content\_xml.load(\_root.XMLsourceFile); // this variable is set on the VARIABLES level, frame 1  
content\_xml.onLoad = function (success:Boolean) {

if (success) {  
// initialize the item list variable (gets the count and values of all the parent items)  
\_root.cardSent = content\_xml.firstChild.firstChild.childNodes;  
\_root.cardData = content\_xml.firstChild.lastChild.childNodes;

// create an array of the card data  
\_root.cardSentNodes = new Array();  
for (i=0; i \< \_root.cardSent.length; i++) {  
\_root.cardSentNodes\* = \_root.cardSent\*.childNodes;  
}

// create an array of the card file details  
\_root.cardDataNodes = new Array();  
for (i=0; i \< \_root.cardData.length; i++) {  
\_root.cardDataNodes\* = \_root.cardData\*.childNodes;  
}

// set all the variables that will/could be used by the imported card  
\_root.sentID = \_root.cardSentNodes[0];  
\_root.cardID = \_root.cardSentNodes[1];  
\_root.senderName = \_root.cardSentNodes[2];  
\_root.senderEmail = \_root.cardSentNodes[3];  
\_root.recipientName = \_root.cardSentNodes[4];  
\_root.recipientEmail = \_root.cardSentNodes[5];  
\_root.carbonCopy = \_root.cardSentNodes[6];  
\_root.messageText = \_root.cardSentNodes[7];  
\_root.serviceYears = \_root.cardSentNodes[8];  
\_root.custom2 = \_root.cardSentNodes[9];  
\_root.custom3 = \_root.cardSentNodes[10];

// set all variables to grab card  
\_root.category = \_root.cardDataNodes[0];  
\_root.cardName = \_root.cardDataNodes[1];  
\_root.cardDescription = \_root.cardDataNodes[2];  
\_root.cardFile = \_root.cardDataNodes[3];

\_root.targetArea.loadMovie(\_root.cardFile);

} // end if success

// load was not a success  
else {  
trace(“XML failed to load.”);  
}

} // end load xml file
