动作脚本-如何从movieClip转到另一个场景?
问题描述:
我试图通过单击放置在mc中的按钮巫婆去另一个场景,但出现错误. 这是我的下面的代码
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");
}
(将此代码放置在movieClip内,在第260帧像"movClip"一样被实例化-可能有助于更好地理解). 这就是我得到的错误: 符号'preloader26',Layer'Layer9',帧260,第4行1120:访问未定义属性movClip 我希望任何人都可以帮助我...非常感谢!
(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!
答
尝试获取对象的父对象,如下所示:
Try to get the parent of the object , like this:
MovieClip(this.parent).gotoAndPlay(1,"Scene 2");