beautypg.com

Triggering code hints – Adobe Flash Professional CS3 User Manual

Page 398

background image

FLASH CS3

User Guide

392

Press Control+Spacebar (Windows) or Command+Spacebar (Macintosh).

From the panel menu

(at the upper-right corner of the Actions panel), select Show Code Hint.

Reload code hints without restarting the software

From the panel menu

(at the upper-right corner of the Actions panel), select Reload Code Hints.

You might need to do this if you customize Script Assist mode by writing custom methods.

Triggering code hints

You can trigger code hints in various ways.

Strict typing for objects

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.

Suffixes and code hints

If you use ActionScript 1.0 or you want to display code hints for objects without strictly typing them, add a suffix to
the name of each object when you create it. For example, the suffix that triggers code hinting for the Camera class is

_cam

. Suppose you type the following code:

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