User Guide
Using the ActionScript editor 145
To set preferences for syntax coloring as you type, do one of the following:
• Select Edit > Preferences, and specify Syntax coloring settings on the ActionScript tab.
• In the Actions panel, select Preferences from the Options pop-up menu (at the upper right of
the panel) and specify Syntax coloring settings on the ActionScript tab.
• With the pointer focused in the Script pane, press Control-U (Windows) or Command-U
(Macintosh).
You can change the color settings for keywords, comments, identifiers and strings. For
information on identifiers and strings, see “Terminology” on page 24 and “String data type”
on page 35. For information on commenting, see “Comments” on page 31.
Writing code that triggers code hints
When you work in the ActionScript editor (either in the Actions panel or Script window), Flash
can detect what action you are entering and display a code hint—a tooltip that contains the
complete syntax for that action or a pop-up menu that lists possible method or property names.
Code hints appear for parameters, properties, and events when you strictly type or name your
objects, as discussed in the rest of this section. Code hints also appear if you double-click an item
in the Actions toolbox or the Add (+) button above the Script pane to add actions to the Script
pane. For information on using code hints when they appear, see “Using code hints” on page 147.
Note: Code hinting is enabled automatically for native classes that don’t require you to create and
name an instance of the class, such as Math, Key, Mouse, and so on.
Strictly typing objects to trigger code hints
When you use ActionScript 2.0, you can strictly type a variable that is based on a built-in class,
such as Button, Array, and so on. If you do so, the ActionScript editor displays code hints for the
variable. For example, suppose you type the following code:
var names:Array = new Array();
names.
As soon as you type the period (.), Flash displays a list of methods and properties available for
Array objects because you have typed the variable as an array. For more information on data
typing, see “Strict data typing” on page 41. For information on using code hints when they
appear, see “Using code hints” on page 147.
Using suffixes to trigger code hints
If you use ActionScript 1, or you want to display code hints for objects you create without strictly
typing them(see “Strictly typing objects to trigger code hints” on page 145), you must add a
special suffix to the name of each object when you create it. For example, the suffixes that trigger
code hinting for the Array class and the Camera class are
_array and _cam, respectively. For
example, if you type the following code:
var my_array = new Array();
var my_cam = Camera.get();