AS3 - gotoAndStop立即采取行动 [英] AS3 - gotoAndStop with immediate action
本文介绍了AS3 - gotoAndStop立即采取行动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是从AS2迁移到AS3,发现这种不兼容性可能之前尽可能多的脂肪酶:
I'm moving from AS2 to AS3 and probably as many ppl before found this incompatibility:
我以前经常$,如C $ C:
I used quite often code like:
gotoAndStop(5);
trace(box); //where box is a movie on 5th frame
什么是如何做到这一点在AS3最简单的方法。
What is the easiest way how to do it in AS3.
推荐答案
有一个简单的方法来解决这个问题,但它是未公开的:
There is an easy way to solve this, but it is undocumented:
addFrameScript(1, update);
gotoAndStop(2);
function update() {
trace(box); // outputs [object MovieClip]
}
请注意,addFrameScript第一个参数是帧数,但它是基于0的,即0是第1帧,1帧2,等等。第二个参数是你想调用的函数。
Please note that the first argument for addFrameScript is the frame number but it's 0-based, i.e. 0 is frame 1, 1 is frame 2, etc... The second argument is the function you would like to call.
这篇关于AS3 - gotoAndStop立即采取行动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文