I have loaded my xml. Works great.
I have set up my ‘for’ loop. Perfect.
Now I’d like to, from the ‘for’ loop, set up an external MC’s onPress function. If I trace - for example - (interactiveNode*.childNodes[0] outside of the function properties, it works great. If I move that same code inside of the function, it returns “undefined”.
How could I set this up to run a loop within the function?
Here is some code:
var interactive_xml:XML = new XML();
interactive_xml.ignoreWhite = true;
interactive_xml.onLoad = function(success:Boolean):Void {
if (success) {
var interactiveLength:Number = interactive_xml.firstChild.childNodes.length;
var interactiveNode = interactive_xml.firstChild.childNodes;
portfolioPieceButton.pieceTitleMC.pieceTitle.htmlText = "";
this.createEmptyMovieClip(interactivePortfolio, i)
for (var i = 0; i<interactiveLength; i++) {
//This does work, but this isn't where I want it to work
trace(_root[interactiveNode*.childNodes[6].firstChild.nodeValue);
_parent.portfolioMCInteractive["interactivePieceButton"+*].onPress = function() {
//This DOESN'T work, but it is where i need it to! :(
trace(_root[interactiveNode*.childNodes[6].firstChild.nodeValue);
}
}
} else {
trace("tiny error");
}
};
interactive_xml.load("myxml.xml");
Thank you :puzzled: