Flash - Controling a Label on Another Frame
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开发者_JS百科 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.
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 :)
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.
精彩评论