i can load xml, get what i want out of the nodes, attach mc’s accordingly, etc. but i’m having trouble figuring out the best way to build a function for a button inside each dynamic mc that works correctly.
I can build the function (which should load the corresponding variable’s value for the array’s position) but when the button is clicked it actually loads the variable associated with one array index position up.
so if i’m clicking on the button that’s supposed to load [0], I get the value for [1]'s variable. make sense?
it seems like it should work. i’ve tried about six different variations… nothing works!!! arrgggghh help!
code:
stop();
holderMc._visible=false;
var columns=1;
var list_spacing = 18;
yamahaList= new XML();
yamahaList.ignoreWhite=true;
yamahaList.onLoad=function(success){
if(success){
trace(this.status);
atvModels = yamahaList.firstChild.childNodes;
trace(atvModels);
for (var i=0; i<atvModels.length; i++) {
item.index = i;
item = holderMc.attachMovie("listClip", "listClip"+i, i);
item._x = (i%columns)*list_spacing;
item._y = Math.floor(i/columns)*list_spacing;
var atvName = atvModels*.attributes.name;
item.atvName=atvName;
item.atvButton.onRelease=function(){
var j=this._parent.index;
var nameatt = atvModels[j].attributes;
yamahaModel=nameatt.name;
holderMc._visible=false;
}
}
}
}
yamahaList.load("yamahaATV.xml");