Flash - 控制另一帧上的标签
好吧,我的 Flash 项目中有 4 个关键帧,我想做的是从一个关键帧转到另一个关键帧,并使用动作脚本使目标关键帧上的一些内容不可见。我知道如何从一个框架转到另一个框架,但我在寻找一种方法来控制另一框架内容的可见性时遇到问题。任何想法都将受到极大的欢迎。
Ok so I have 4 key frames in my flash project and what i'm trying to do is to go from one key frame to another and make some of the content on the destination key frame invisible using actionscript. I know how to go from one frame to another but i'm having problems finding a way to control the visibility of content from another frame. Any ideas would be greatly welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您使用 AS3 并为给定的 MovieClip 定义了一个类:
您可能希望使用另一种技术 - 使用 addFrameScript() 方法,而不是直接在 MovieClip 的时间轴上编写代码。有了这个,您可以提供一个帧号(从零开始的索引)和给定的回调方法,以便在到达该帧号时调用。
该函数在 Adobe LiveDocs 中没有得到很好的记录,但在这里有很好的解释:
http://troyworks.com/blog/2007/09/22/as3- movieclipaddframescript/
您还可以制作(或找到)一些实用程序类,可以执行“addFrameScriptByLabel()”操作,在其中提供影片剪辑、帧标签和帧标签。回调而不是帧号 &打回来。这样,如果您的符号时间轴的长度或排列发生变化,并且您仍然在整个时间轴中使用这些标签 - 您的代码将不需要修改,因为它不依赖于帧编号:)
Provided that you are using AS3 and have a class defined for your given MovieClip:
Instead of writing code directly on your MovieClip's timeline, you may want to use an alternative technique - using the addFrameScript() method. With this, you can supply a frame number (zero-based index) and the given callback method to call once it reaches that frame number.
The function isn't very well documented in the Adobe LiveDocs, but it is very well explained here:
http://troyworks.com/blog/2007/09/22/as3-movieclipaddframescript/
You could also make (or find) some utility class that could do an "addFrameScriptByLabel()" where you supply a movieclip, frame-label & callback instead of a frame-number & callback. That way, if your Symbol's timeline ever changes in length or arrangement and you still use those labels throughout your timeline - your code won't have to be modified since it won't depend on frame-numbers :)
在目标关键帧处,编写内容可见性的代码。
也许你会使用 stop();将头部保持在关键帧上的命令。低于该 stop();命令内容1.visible = false;
因为 as3 中没有事件,所以一旦加载框架,所有编写的代码都将被执行。
At the destination keyframe , write the code for the visibility of the content.
probably u would use stop(); command to hold the head on the keyframe. below that stop(); command content1.visible = false;
since without events in as3 , all the code written will be executed once the frame is loaded.