O'Reilly logo

Learning ActionScript 3.0 by Zevan Rosser, Rich Shupe

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Frame Labels

Using frame numbers with goto methods has specific advantages, among them simplicity and use in numeric contexts (such as with a loop or other type of counter). However, frame numbers also have specific disadvantages. The most notable disadvantage is that edits made to your file after your script is written may result in a change to the frame sequence in your timeline.

For example, your help section may start at frame 100, but you may then insert or delete frames in a section of your timeline prior to that frame. This change may cause the help section to shift to a new frame, and your navigation script will no longer send the playback head to the help section.

One way around this problem is to use frame labels to mark the location of a specific segment of your timeline. As long as you shift content by inserting or deleting frames to all layers in your timeline—therefore, maintaining sync among your layers—a frame label will move with your content.

For example, if your help section, previously at frame 100, is also marked with a frame label called "help," adding 10 frames to all layers in your timeline will not only shift the help content, but will also shift the frame label used to identify its location. So, although you will still be navigating to the "help" frame label after the addition of frames, you will correctly navigate to frame 110.

This is a useful feature when you are relying heavily on timeline tweens for file structure or transitions (as we'll see in our demo ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required