How to Use Frame Labels in Scenes in Macromedia Flash
As a complete and authoritative animation program, Adobe Flash must be capable of allowing users to move across various scenes and areas within a movie in an instant. Part of the technology that Flash uses, ActionScript, allows Flash programmers to jump from scene to scene using a simple command. Further, within each scene, programmers can modify that code to go to specific frames using frame labels.
Instructions
-
Design Your Complete Project
-
1
Whether you are using Flash to animate a movie, build a website or create a desktop application, the first step is to design it from start to finish. You can use multiple scenes as needed.
-
2
Keep track of your specific frames that you will want to access using ActionScript while you are creating your movie.
-
-
3
Label your frames as needed. This is done by left-clicking on the specific keyframe you want to label and then, in the Properties Inspector, typing a name into the "Name" box under the Label section. Note that frame labels should not contain spaces or special characters such as "!@#$%^&".
Use ActionScript to Access Your Frame Labels
-
4
During your movie, you will want to access specific frames on specific scenes at certain times or events. The simplest code to jump to a frame label is:
gotoAndStop("myLabel")
You can use gotoAndPlay as well, of course, but the important thing to note is that the name of your frame label is in quotes in parenthesis.
-
5
If you want to jump to a different scene and frame label use the following code:
stop();
gotoAndStop("Scene 2", "myLabel2")The "Scene 2" should be replaced by whatever scene name you have chosen. While the scene name in the code is not absolutely necessary, since all frame labels in Flash should be unique and the code will work without it (going to the "myLabel2" frame wherever it is in the movie), it is good scripting etiquette to use it. This will help you or anyone who comes after you to debug the code if needed, by telling them exactly where "myLabel2" is.
-
6
Avoid using scene labels or any ActionScript if you are just creating a simple sequence file in Flash such as an animated gif, as the code will not work in the final, exported movie.
-
1
Tips & Warnings
Use camel-case when naming your labels. For example: "alienAttackStart" or "jediFightEnd". Start the first word lower-case and every word after that with an uppercase letter.
References
Resources
- Photo Credit movie reel image by Maria Bell from Fotolia.com