homepage Welcome to WebmasterWorld Guest from 54.196.207.55
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

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




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

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

 

eelixduppy




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

You get this to work yet? At a very quick glance I don't see anything.

Modern Merlin




msg:3709961
 4:32 am on Jul 29, 2008 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved