问题
I'm trying to go to another scene by clicking a button witch is placed in a mc and I got an error. This is my code below
Play_btn.addEventListener(MouseEvent.CLICK,gotoScene2);
function gotoScene2(evt:MouseEvent){
movClip.gotoAndPlay(1,"Scene 2");
}
(this code is placed inside a movieClip witch is instantiated like "movClip", at frame 260 - may be this help to understand better). And this is the erorr i get: Symbol 'preloader26',Layer'Layer9',Frame 260,Line 4 1120:Access of undefined property movClip I hope anyone can help me...thanks very much!
回答1:
Try to get the parent of the object , like this:
MovieClip(this.parent).gotoAndPlay(1,"Scene 2");
来源:https://stackoverflow.com/questions/16997398/action-script-how-to-go-to-another-scene-from-movieclip