动作脚本-如何从movieClip转到另一个场景? [英] Action Script - how to go to another scene from movieClip?
本文介绍了动作脚本-如何从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");
这篇关于动作脚本-如何从movieClip转到另一个场景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文