How to Use Frame Labels in Scenes in Macromedia Flash
- 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 "!@#$%^&".
- 1). 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. - 2). 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. - 3). 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.