Function within XML loop problems

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]:wink: 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
			_parent.portfolioMCInteractive["interactivePieceButton"+*].onPress = function() {
				//This DOESN'T work, but it is where i need it to! :(
    } else {
        trace("tiny error");


Thank you :slight_smile: :puzzled: