Hello, everyone! I suppose there has been such a topic already, but I cannot find it. I have been doing some XML menu (I have covered all the XML tutorials here on kirupa.com) and the code is doing just fine. I am using this one:
item_spacing = 100;
item_count = 0;
function BuildMenu(menu_xml){
broj = menu_xml.firstChild.childNodes;
for(i=0;i<broj.length;i++){
if(broj*.attributes.name == "menu"){
var labels = broj*.firstChild;
var item_mc = menu_mc.attachMovie("button_mc", "button"+item_count+"_mc", item_count);
item_mc._x = item_count*item_spacing;
item_count++;
item_mc.menu_txt.text = labels.nodeValue;
}
}
}
var menu_xml = new XML();
menu_xml.ignoreWhite = true;
menu_xml.onLoad = function(success){
if(success){
BuildMenu(this);
}
else{
trace("Error");
}
}
menu_xml.load("menu.xml");
The “button_mc” I am attaching to the “menu_mc” consists of a dynamic text field and a rectangle which is transformed to a button using this code:
frame 1:
stop();
this.onEnterFrame = function(){
if(rewind == true){
prevFrame();
}
}
this.onRollOver = this.onDragOver = function(){
rewind = false;
play();
}
this.onRollOut = this.onDragOut = function(){
rewind = true;
}
frame 6:
stop();
The XML file looks something like this:
<menu>
<item name="menu" link="movie1.swf">HOME</item>
<item name="menu" link="movie2.swf">PROFILE</item>
.
.
.
</menu>
The menu builds without any problems. But, now comes the problematic part… I want to give those buttons in the menu the function to load .swf-s into the “loader_mc” which is on the main timeline. “loader_mc” is basically the place where I want my “movie1.swf” etc. to load into.
I have been trying to figure it out by myself for two days now and I gave up. I hope someone can help me with this. What can I do (what code to write) so that every button gets to load a different .swf into the “loader_mc”?
Thanks in advance!!!:hugegrin: :hugegrin: