Hi, new to actionScript and trying to finish my final project, and i’m banging my head on a brick wall now, my question may be easy for some pros, so please help!!!
basically i’ve loaded an external swf from a button at main.swf
function loadSWF( e:MouseEvent ):void {
var url:String;
var buttonPressed:Sprite = e.currentTarget as Sprite;
if( buttonPressed == button1){
url = "./content1.swf"
}
}
this works fine.
then i’m trying to disable the button function while the swf is loaded. I add another eventListener to the same button.
function disableMenu( e:MouseEvent ):void {
button1.mouseEnabled = false;
}
that works too. ok now comes the problem. I have a close button on my child swf("content1.swf) to close itself and returen to main swf.
but I want the button on main.swf to work again. so at the close button I add another eventListener hope to enable the menu.
(note this is on the child swf!)
function enableMenu ( e:MouseEvent ):void{
root.button1.mouseEnabled = true;
}
I thought the root will take me back to the main swf but apparently it doesn’t. I keep on getting the error msg of button 1 is not defined.
this child swf is loaded from xml. and the close button is created by using AS file. The “button1” is just on the stage of the main swf. Maybe these make some difference so i can’t just point it back using (root)?
Any idea how do I resolve this? Or am I not supposedd to do it this way at all? Sorry I’m a newb to AS still…
Any help will be appriciated!!! thanks in advance!