Using code hints

When you work in the ActionScript editor, Flash can detect what action you are entering and display a code hint—a tooltip containing the complete syntax for that action or a pop-up menu listing possible method or property names. Code hints appear for parameters, properties, and events when you enter certain characters in the ActionScript editor.

Code hints are enabled by default. By setting preferences, you can disable code hints or determine how quickly they appear.When code hints are disabled in preferences, you can turn them on manually.

To enable automatic code hints:

  1. Select Preferences from the Actions panel pop-up menu (at the upper right of the panel).
  2. On the ActionScript Editor tab, select Code Hints.

To enable manual code hints in expert mode, do one of the following:

To work with tooltip-style code hints:

  1. Type an open parenthesis [(] after an action name.
  2. The code hint appears.

  3. Enter a value for the parameter. If there is more than one parameter, separate the values with commas.
  4. Overloaded functions or methods such as gotoAndPlay or for (that is, functions or methods that can be invoked with different sets of parameters) display an indicator that allows you to select the parameter you want to set. Click the small arrow buttons or press Control+Left Arrow key and Control+Right Arrow key to select the parameter.

  5. To dismiss the code hint, do one of the following:

To work with menu-style code hints:

  1. Display the code hint by doing one of the following:
  2. To navigate through the code hint, use the Up and Down Arrow keys.
  3. To select an item in the menu, press Return or Tab, or double-click the item.
  4. To dismiss the code hint, do one of the following:

Many ActionScript objects require you to create a new instance of the object in order to use its methods and properties. For example, in the code myMovieClip.gotoAndPlay(3), the gotoAndPlay method tells the instance myMovieClip to go to a specific frame and begin playing the movie clip. The Actions panel doesn't know that the instance myMovieClip is of the object class MovieClip, and therefore doesn't know which code hints to display.

If you want the Actions panel and external editor to display code hints for object instances, you must add a special class suffix to each instance name. For example, to display code hints for the class MovieClip, you must name all MovieClip objects with the suffix _mc, as in the following examples:

Circle_mc.gotoAndPlay(1);
Sqaure_mc.stop();
Block_mc.duplicateMovieClip("NewBlock_mc", 100);

See Naming a variable for a list of code hint suffixes supported by the Actions panel and external editor.

You can also use ActionScript comments to specify an object's class for code hinting. The following example tells ActionScript that the class of the instance theObject is Object, and so on. If you were to enter mc followed by a period after these comments, a code hint would display the list of MovieClip methods and properties; if you were to enter theArray followed by a period, a code hint would display a list of Array methods and properties, and so on.

// Object theObject;
// Array theArray;
// MovieClip mc;

Note: This technique works only for built-in classes, not for those defined in external class files.

For more information about object classes in ActionScript, see .