gotoAndStop(label) 失败并出现错误 2109

发布于 2024-12-15 00:21:09 字数 863 浏览 0 评论 0原文

我有两个影片剪辑:

mov1 has frames with labels in such sequence ("item"," btn", "win", "loose")
mov2 has frames with labels in such sequence (" ", "item", "win", "loose")

这是两个标准化的影片剪辑,它们由一类 MovItem 统治。 在 MovItem 的构造函数中,我 init:

public function MovItem(item_mc:MovieClip )
        {
            this.item_mc.addEventListener( MouseEvent.CLICK, dispatchEvent );

            //this.item_mc.gotoAndStop('btn');
            this.item_mc.gotoAndStop(1);        
        }

在 Web 版本中一切正常,但在 AIR 2.6 for Android 中,它失败并出现错误:

Error #2109: Frame label btw not found.

在没有此类标签的元素上的 gotoAndStop('btn');

当我 gotoAndStop(1); 处理这个项目时,一切正常。 一切都应该很好,但是第二个影片剪辑上的“btw”标签位于第二帧上。

如何轻松修复它而不需要对 .fla 资源进行彻底返工?为什么它在 Web 应用程序上有效,但在 AIR 上却失败?谢谢你的时间。

I have two movie clips:

mov1 has frames with labels in such sequence ("item"," btn", "win", "loose")
mov2 has frames with labels in such sequence (" ", "item", "win", "loose")

This is two standardized movie clips, which are ruled by one class MovItem.
In constructor of MovItem I init:

public function MovItem(item_mc:MovieClip )
        {
            this.item_mc.addEventListener( MouseEvent.CLICK, dispatchEvent );

            //this.item_mc.gotoAndStop('btn');
            this.item_mc.gotoAndStop(1);        
        }

In web version all works correctly, but in AIR 2.6 for Android it fails with error:

Error #2109: Frame label btw not found.

on gotoAndStop('btn'); on element which don't have such label.

And when I'm gotoAndStop(1); on this item all works fine.
All should be great, but 'btw' label on second movie clip is situated on second frame.

How can I fix it easily without total rework in .fla resources? Why does it works on web application, but on AIR fails? Thanx for you time.

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

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

发布评论

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

评论(1

我是男神闪亮亮 2024-12-22 00:21:09

这实际上发生在 Web 版本和 AIR 版本中,因为 mov2 没有名为 btn 的框架。

在网络版本上,您将收到编译器警告,但它不会退出应用程序,而是会忽略 gotoAndStop()。但是,当编译为 AIR 时,编译器处于严格模式,该模式会将编译器警告转换为错误,并且在修复它们之前不允许您进行编译。

无论如何,调用您知道错误的函数(尤其是在构造函数方法中)都是不好的做法,因此您应该将帧作为参数传递给构造函数(如果它们要使用不同的帧编号)或显式为其提供帧number 例如 gotoAndStop(2) (如果它们都转到相同的帧编号)。

另请检查您是否拼写错误了框架,因为您在问题中将框架同时称为 btnbtw

This is actually happening in both the web version and the AIR version because mov2 has no frame called btn.

On the web version you will get a compiler warning but instead of quitting the application it just ignores the gotoAndStop(). However when compiling to AIR the compiler is in strict mode which converts compiler warnings to errors and won't allow you to compile until they are fixed.

It is bad practice anyway to call a function that you know is erronous (especially in a constructor method) so you should ether pass the frame to the constructor as a parameter (if they are going to different frame numbers) or explicitly give it the frame number e.g. gotoAndStop(2) (if they all go to the same frame number).

Also check you haven't misspelt the frame as you refer to the frame as both btn and btw in your question.

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