This works fine:
_root.artist_mc.cd_btn0.onRelease = function(){
_root.discDetail_mc._visible = true;
_root.discDetail_mc.cdTitle_txt.text = thisItem.menu_item_btn.cdTitle[0];
}//Ends this onRelease function
_root.artist_mc.cd_btn1.onRelease = function(){
_root.discDetail_mc._visible = true;
_root.discDetail_mc.cdTitle_txt.text = thisItem.menu_item_btn.cdTitle[1];
}//Ends this onRelease function
_root.artist_mc.cd_btn2.onRelease = function(){
_root.discDetail_mc._visible = true;
_root.discDetail_mc.cdTitle_txt.text = thisItem.menu_item_btn.cdTitle[2];
}//Ends this onRelease function
But this just gives me “undefined”. If I set the dynamic text to = n, I always get “3” (the length of the array).
for(n=0;n<thisItem.menu_item_btn.cdTitle.length;n++){
_root.artist_mc["cd_btn"+n].onRelease = function(){
_root.discDetail_mc._visible = true;
_root.discDetail_mc.cdTitle_txt.text = thisItem.menu_item_btn[cdTitle[n]];
}
}
So why doesn’t the for loop work?