You can trigger code hints in various ways.
When you use ActionScript 2.0 and use strict typing for a variable that is based on a built‑in class (such as Button, Array, and so on), the Script pane displays code hints for the variable. For example, suppose you enter the following two lines of code:
var foo:Array = new Array(); foo.
As soon as you enter the period (.), Flash displays a list of methods and properties available for Array objects in a pop-up menu, because you typed the variable as an array.
var my_array = new Array(); var my_cam = Camera.get();
If you then enter my_cam followed by a period, code hints for the Camera object appear.
For objects that appear on the Stage, use the suffix in the Instance Name box in the Property inspector. For example, to display code hints for MovieClip objects, use the Property inspector to assign instance names with the _mc suffix to all MovieClip objects. Then, whenever you type the instance name followed by a period, code hints appear.
Although suffixes are
not required for triggering code hints when you use strict typing
for an object, using suffixes consistently helps make your code
understandable.The following table lists the suffixes that trigger code hints in ActionScript 2.0:
|
Object type |
Variable suffix |
|---|---|
|
Array |
_array |
|
Button |
_btn |
|
Camera |
_cam |
|
Color |
_color |
|
ContextMenu |
_cm |
|
ContextMenuItem |
_cmi |
|
Date |
_date |
|
Error |
_err |
|
LoadVars |
_lv |
|
LocalConnection |
_lc |
|
Microphone |
_mic |
|
MovieClip |
_mc |
|
MovieClipLoader |
_mcl |
|
PrintJob |
_pj |
|
NetConnection |
_nc |
|
NetStream |
_ns |
|
SharedObject |
_so |
|
Sound |
_sound |
|
String |
_str |
|
TextField |
_txt |
|
TextFormat |
_fmt |
|
Video |
_video |
|
XML |
_xml |
|
XMLNode |
_xmlnode |
|
XMLSocket |
_xmlsocket |
You can also use ActionScript comments to specify an object’s class for code hints. In the following example, a comment tells ActionScript that the class of the theObject instance is Object, and so on.
// Object theObject;// Array theArray;// MovieClip theMC;
If you subsequently enter theMC followed by a period, code hints that display the list of MovieClip methods and properties appear. If you enter theArray followed by a period, code hints that display the list of Array methods and properties appear, and so on.
Instead of this technique, however, Adobe recommends that you use strict data typing or suffixes, because these techniques enable code hints automatically and make your code more understandable.