1 Attachment(s)
Target Path and Parsing XML
Hi All...
Thanks in advance for taking the time to read this. (I'm using Flash CS3 with AS 2.0)
I'm having a problem referencing some variables once I create MovieClips out of some of my elements. Here is what I'm doing:
The user inputs a ZIP code (among other things) which then passes the zip code parameter in the URL to generate some XML. Flash then displays some of the XML in some dynamic text boxes.
It works just fine on a very basic stage (no symbols, movieclips, etc created), but when I start to create movieclips out of some elements it's stops working... Which tells me that I'm not targeting some of the elements correctly, but I can't seem to get it right :(
I attached a zip with two flash files: 1 flash file "XML_loading_passvars.fla" which was working for me. The other file "XML_loading_passvars_combinedtoMC.fla" I started creating movieclips and it no longer worked!
movie clip A:
user enters a zip code
movie clip B:
user enters another parameter
In movie clip C, I display some of the returned XML.
In movie clip B, I have the following actionscript:
Code:
stop();
this.btn_send.onRelease = function() {
_root.nextFrame();
//create the XML object
var myXML:XML = new XML();
//ignore the white space
myXML.ignoreWhite = true;
//define content type
myXML.contentType = "text/xml";
//create the event for when it loads content
myXML.onLoad = function(success) {
if (success) {
//displays the number of results returned
results_txt.text = this.firstChild.firstChild.firstChild.nodeValue;
//displays the number of results returned
name_txt.text = this.firstChild.firstChild.nextSibling.firstChild.firstChild.firstChild.nodeValue;
//traces whether or not the XML loaded successfully
trace("yay, this loaded indeed");
//this will trace the first node
trace(this.childNodes);
} else {
trace("there was a major error");
}
};
//now load the content
myXML.load("http://xmlurl.com/?"+"search_permitted_zipcode="+this.Symbol3.input_zipcode.zipcode+"&photo="+photo,"_blank","GET");
// when the load() method is called, the property is set to fales; when the content has loaded, it is changed to true
myXML.loaded;
// this will state whether or not the loaded CML content has child nodes
myXML.hasChildNodes();
//displays a number representing the error that occured, if any
myXML.status;
};