beautypg.com

Adobe Flash Professional CC 2014 v.13.0 User Manual

Page 687

background image

Note: If you cannot display code hints for a variable or object you created in ActionScript 2.0, but code hints are enabled in ActionScript
preferences, make sure you named your variable or object with the proper suffix or that you used strict typing for your variable or object.

Enabling code hinting

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

Error

_err

LoadVars

_lv

LocalConnection

_lc

Microphone

_mic

MovieClip

_mc

MovieClipLoader

_mcl

PrintJob

_pj

NetConnection

_nc

NetStream

_ns

SharedObject

_so

680