Macromedia Flash MX 2004 Killer Tips

[ LiB ] 

When using the ActionScript window, Flash has automatic completion support, which means that as you type, a list of methods and properties for known code will appear. You may have already noticed that while typing _root, Flash automatically gives you a list of actions that apply to a movie clip. The cool thing is that Flash will do this for your own customized variables too. However, because Flash doesn't keep track of what type your variable is, you'll have to name them according to a specific format in order to take advantage of this built-in tip system. The trick is to suffix the name of your variable with a couple letters that indicate to Flash what type of variable you are referring to. Then Flash will pop up a list of actions and methods for that type of object even though it's your own variable and one that's built into Flash. Some of the most commonly used suffixes are listed below. Name your variables with these suffixes and Flash will make typing code easier than ever and make your code easier for others to follow and understand. For a complete list of supported suffixes, search Flash's help system for "triggers code hints" and you'll see them all.

Type

Suffix

Example

Array

_array

myList_array

Button

_btn

myButton_btn

Color

_color

myColor_color

Date

_date

myDate_date

Movie Clip

_mc

myMovie_mc

Sound

_sound

myMusic_sound

String

_str

myVar_str

Text Field

_txt

myField_txt

XML

_xml

myData_xml

[ LiB ] 

Категории