Labels (Frame)

Labels (Frame)

Flash CS4 ActionScript 3.0 Tutorial

 

How to Label Frames with Names and Visual Reminders in Flash

 

 

Frame Labels are great organization tools. The labels are placed on a separate layer (usually the upper-most layer) and provide the programmer with words to describe the current location on the timeline.

Labels can also be used by ActionScript to send the user to a specific label in the timeline. It is good practice to stick to camel case naming conventions when naming labels. For more information on camel case, see topic, Variables. Be careful not to place any objects or other content on the Labels layer.

 

Step One

In a new Flash document, name the default layer Labels.

Step Two

Click frame 10 of the Labels layer and press F5. Then click the keyframe at frame 1.

Step Three

Open the Properties panel (Cmd/F3 (PC - Ctrl/F3) and add the word intro in the Name box, then press Return (PC - Enter).

Step Four

The new label displays on the timeline.

Editing Labels

To change a frame label, click on the label keyframe, enter a different word in the label Name text box, then press Return (PC - Enter).

Displaying Current Label in Text Field

To display the current label (i.e., home) in a Dynamic text field with an instance name of labelText_txt, you would use the following code:

labelText_txt.text="currentLabel"

//home would display

 

Stock Images