Welcome to WebmasterWorld Guest from 23.20.230.24

Forum Moderators: open

Message Too Old, No Replies

SWF menu inside another SWF [AS] 2.0 [CS3]

     
2:05 pm on Jul 23, 2008 (gmt 0)

5+ Year Member



Crruent I have an SWF Ill call main for now and an SWF I will call menu. The Menu was written by AdrianTNT (very nice btw) and edited slighty to pull the data form the XML file in hopes to have it go to _root scenes (it was originally written to go to actual URLs and I only have 1).

The issue is, it grabs the information I need from the XML file but goes no further when I click on the buttons.

ActionScript 2.0
<font size="1">//hide the flash right click menu items:
Stage.showMenu = false;
Stage.scaleMode = "noScale";
Stage.align = "TL";
//hide the flash menu until the XML loads
_parent._visible = true;
// xml processing
menu_cfg_xml = new XML();
menu_cfg_xml.load(String(_url.slice(0, (_url.length-3)))+"xml");
menu_cfg_xml.ignoreWhite = 1;
//
menu_cfg_xml.onLoad = function(ok) {
// create main menu after successful loading of XML
if (ok) {
create_menu();
} else {
trace("XML not loaded");
}
};
//
counter = 1;
function create_menu() {
while (counter<menu_cfg_xml.firstChild.childNodes.length) {
attachMovie("button_type", "btn"+counter, counter);
set("btn"+counter+"._y", counter*26-26);
btn1._y = 0;
// set the buttons text
set("btn"+counter+".the_text", menu_cfg_xml.firstChild.childNodes[counter].attributes.text);
set("btn"+counter+".the_scene", menu_cfg_xml.firstChild.childNodes[counter].attributes.scene);
set("btn"+counter+".the_frame", menu_cfg_xml.firstChild.childNodes[counter].attributes.framenr);

this["btn"+counter].onRollOver = this["btn"+counter].onDragOver=function () {
this.effect.gotoAndPlay(2);
this.textul1.textColor = "0x"+menu_cfg_xml.firstChild.childNodes[0].attributes.text_color2;
};
this["btn"+counter].onRollOut = this["btn"+counter].onDragOut=function () {
this.textul1.textColor = "0x"+menu_cfg_xml.firstChild.childNodes[0].attributes.text_color1;
this.effect.gotoAndPlay(9);
};
this["btn"+counter].onRelease = function() {
if (this.the_scene != undefined and this.the_scene != "") {
_root.gotoAndPlay(this.the_scene, this.the_frame);
trace(this.the_scene);
trace(this.the_frame);
}
};
//set buttons color
this["button_color"+counter] = new Color("btn"+counter+".btn_color");
this["button_color"+counter].setRGB("0x"+menu_cfg_xml.firstChild.childNodes[0].attributes.button_color);
//set button effect color
this["effect_color"+counter] = new Color("btn"+counter+".effect");
this["effect_color"+counter].setRGB("0x"+menu_cfg_xml.firstChild.childNodes[0].attributes.effect_color);
//set button text color
this["btn"+counter].textul1.textColor = "0x"+menu_cfg_xml.firstChild.childNodes[0].attributes.text_color1;
counter++;
}
_parent._visible = true;
info_clip._visible = false;
}</font>

And the buttons all look linke this in the XML file:
<button text="Main Menu" scene="Main Menu" framenr="Menu_start"></button>

About rdy to pull my hair out! Anyone have any ideas? Thanks!

MM

4:00 am on Jul 29, 2008 (gmt 0)

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 5+ Year Member



You get this to work yet? At a very quick glance I don't see anything.
4:32 am on Jul 29, 2008 (gmt 0)

5+ Year Member



Actually I was jsut told that it was impossible to get this to work as I was trying to call to a specific frame inside of a scene.

[senocular.com...] Unless you have any ideas? LOL

 

Featured Threads

Hot Threads This Week

Hot Threads This Month