开发者

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");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜