help with scenes
I have 2 scenes, and when in Scene1, click at the button, goto Scene2, where there's button that I want to add some event.
I resume the code:
//file myclass.as (it's just an example).
public class myclass extends MovieClip{
public function myclass(){
buttonScene1.addEventListener(MouseEvent.CLICK,buttonClickHandler);
}
function buttonClickHandler(event:MouseEvent):void {
//I want to go to scene2
this.addEventListener(Event.ENTER_FRAME,EnterFrame );
}
function EnterFrame(event:Event):void {
this.removeEventListener(Event.ENTER_FRAME,EnterFrame );
gotoAndPlay(1, "myscene2"); // it have 25 frames
// this button is only in the last frame(number 25), but always is null
if(buttonScene2 != null){
buttonScene2.addEventListener(MouseEvent.CLICK,buttonClick);
}
}
}
The point is where I put the event from buttonScene2.
Thanks in advance