Using built-in functions

A function is a block of ActionScript code that can be reused anywhere in a SWF file. 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 let you access certain information and perform certain tasks, such as getting the version number of Flash Player hosting the SWF file (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.

To call a function, simply use the function name and pass any required parameters:

isNaN(someVar);
getTimer();
eval("someVar");

For more information on each function, see its entry in ActionScript Dictionary Overview.