AS3如何正确播放MovieClips

发布于 2024-12-17 08:38:14 字数 257 浏览 2 评论 0原文

我在某个帧上使用 AS3,如果我调用某个 MovieClip 的实例名称“guy”,它将启动该 MovieClip 的父级,而不是它本身。

MovieClip(root).guy.play();

如果我尝试玩(); “guy”的子级:

MovieClip(root).guy.feet1.play();

它会说 foot1 未定义。

有什么建议吗?

I'm using AS3 on a certain frame, If I call the instance name "guy" of some MovieClip it will start the parent of that MovieClip, and not itself.

MovieClip(root).guy.play();

If I try to play(); a child of "guy":

MovieClip(root).guy.feet1.play();

It will say that feet1 is undefined.

Any advice?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

岁月蹉跎了容颜 2024-12-24 08:38:14

我认为是词根

MovieClip(guy).play();
MovieClip(guy).feet1.play();
(getChildByName('guy') as MoviClip).play();
(getChildByName('guy') as MoviClip).feet1.play();

I think is the root word

MovieClip(guy).play();
MovieClip(guy).feet1.play();
(getChildByName('guy') as MoviClip).play();
(getChildByName('guy') as MoviClip).feet1.play();
桃扇骨 2024-12-24 08:38:14

root 将转到当前 SWF 的最父级显示对象(如果该 SWF 加载到另一个 SWF 中,它仍然只会显示当前 SWF 的显示对象)。

因此,一般规则是不要使用 root(尽管 root 并不像 AS2 中那样邪恶,而且偶尔也会有一些原因导致您可能会使用它)。

如果 guy 在舞台上,并且您的动作脚本也在舞台上,则以下内容应该有效:

guy.play();
guy.feet1.play();

root will goto the parent most display object of the current SWF (if the SWF is loaded in another SWF, it will still surface only to that of the current SWF).

So as a general rule don't use root (although root isn't evil like in AS2, and there are occasional reasons why you might use it).

If guy is on the stage, and your actionscript is on the stage, the following should work:

guy.play();
guy.feet1.play();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文