Hi guys,
I have been trying to get this right for a few days now, but I am stumped. This code runs on the first frame of my movie:
_global.headingText = new Array();
_global.captionText = new Array();
_global.contentText = new Array();
_global.photos = new Array();
var spacing:Number = 20;
var my_xml:XML = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success){
if(success){
checkLoad(this);
//_global.myVar = new XML(this);
}else{
trace("error loading");
}
}
my_xml.load("text.xml");
function checkLoad(xml){
for(var i:Number = 0; i<my_xml.firstChild.childNodes.length; i++){
//running through the XML structure to populate the arrays we created up top.
headingText* = my_xml.firstChild.childNodes*.childNodes[0].firstChild.nodeValue;
captionText* = my_xml.firstChild.childNodes*.childNodes[1].firstChild.nodeValue;
contentText* = my_xml.firstChild.childNodes*.childNodes[2].firstChild.nodeValue;
photos* = my_xml.firstChild.childNodes*.childNodes[3].firstChild.nodeValue;
//trace(headingText*);
}
for(var z:Number = 0; z<my_xml.firstChild.childNodes.length; z++){
duplicateMovieClip("content_mc","content"+z+"_mc",z);
_root["content"+z+"_mc"]._x = (100*z)+650;
content_mc.contentTxt.text = contentText*;
}
}
evrything loads fine, and all is well. When i try to reference headingText* in a movie clips timeline ie myClip’s timeline, it does not allow this. I have used _global when creating my variables, as you can see. When in myClip’s timeline and I trace(headline) I get the three values for those specific nodes. When i try and trace(headingText*) I get an undefined.
I have also tried this:
_global.myVar = headingText* = my_xml.firstChild.childNodes*.childNodes[0].firstChild.nodeValue;
but then it only traces the last node value.
What am I doing wrong, this is really getting to me…
thanks in advance.