Problem is the actual reference to the button itself. When I run a trace on item_mc it reveals that the buttons are named main_btn0 thru to main_btn4 as expected. Problem is that when I use the reference main_btn0 and so on nothing happens. However if I use a reference to just main_btn the buttons work but action is not assigned to any particular button?? Why???
var track_xml = new XML();
track_xml.ignoreWhite = true;
track_xml.onLoad = function(success){
if (success) CreateMenu(this);
else trace(“Error loading XML file”);
}
track_xml.load(“tracks.xml”);
var item_spacing = 23;
var item_count = 0;
function CreateMenu(menu_xml){
var items = menu_xml.firstChild.firstChild.childNodes;
for (var i=0; i<items.length; i++) {
if (items*.attributes.type == “track”) {
var track = items*.firstChild.childNodes;
var item_mc = menu_mc.attachMovie(“main_btn”,“main_btn”+item_cou nt, item_count);
item_mc._y = (item_count * item_spacing);
item_count++;
item_mc._x = 0
item_mc.track_txt.text = track;
}
}
}
[COLOR=black]item_mc.[COLOR=#000080]main_btn0[/COLOR].[COLOR=#0000ff]onPress[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]trace[/COLOR] COLOR=#000000[/COLOR]
[COLOR=#000000]}[/COLOR][/COLOR]