Action Script - how to go to another scene from movieClip?

吃可爱长大的小学妹 提交于 2020-07-19 20:44:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!