Understanding the ActionScript Language > Using built-in functions |
![]() ![]() ![]() |
Using built-in functions
A function is a block of ActionScript code that can be reused anywhere in a movie. If you pass values as parameters to a function, the function will operate on those values. A function can also return values.
Flash has built-in functions that allow you to access certain information and perform certain tasks, such as getting the version number of the Flash Player hosting the movie (getVersion
). Functions that belong to an object are called methods. Functions that don't belong to an object are called top-level functions and are found in the Functions category of the Actions panel.
Each function has its own characteristics, and some functions require you to pass certain values. If you pass more parameters than the function requires, the extra values are ignored. If you don't pass a required parameter, the empty parameters are assigned the undefined
data type, which can cause errors when you export a script. To call a function, it must be in a frame that the playhead has reached.
The top-level built-in Flash functions are listed in the following table.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note: Because string functions are deprecated, they are not listed in this table.
To call a function, you use the Actions panel in expert mode or normal mode. For more information about these modes, see Working in expert mode and Working in normal mode.
To call a built-in function:
Choose the Functions category in the Actions toolbox, and double-click a function name to add to a script.
![]() ![]() ![]() |