Flash go to frame label action
It is my first time using AS3.
The way that is set up us I have a "Main MOvie Clip" and inside the main movie clip I have another movie clip which is the MainMenu.
Inside the MainMenu a开发者_JS百科re buttons. The frame label I wanted to go to in outside of the MainMenu but Inside of the MainMovieClip.
I am doing a small project that involves gotoAndPlay("frame label")
In the action layer at the end of the timeline of the MainMenu Moviclip Here is my code:
btn1.addEventListener(MouseEvent.MOUSE_UP,mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
gotoAndPlay("nordic");
}
stop();
The error I get:
TypeError: Error #1009: Cannot access a property or method of a null object reference. at Ronor_CD20100421_fla::mainMenu_3/frame27()
If the code resides in MainMenu and MainMenu is located in the MainMovieClip you should use:
function mouseDownHandler(event:MouseEvent):void {
MovieClip(this.parent).gotoAndPlay("yourLabel");
}
Cheers
You need to reference the object you want to change. For example:
mainMovieClip.gotoAndPlay("nordic");
精彩评论