MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference page 199

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

You can use this statement to define a
, and
parameters
statement(s)
function's definition are executed. Forward referencing is permitted; within the same script, a
function may be declared after it is called. A function definition replaces any prior definition
of the same function. You can use this syntax wherever a statement is permitted.
You can also use this statement to create an anonymous function and return a reference to it.
This syntax is used in expressions and is particularly useful for installing methods in objects.
For additional functionality, you can use the
Some common uses of the
number of parameters and creating a recursive anonymous function.
Availability: ActionScript 1.0; Flash Lite 2.0
Returns
- Usage 1: The declaration form does not return anything. Usage 2: A reference to the
String
anonymous function.
Parameters
functionname:String
Example
The following example defines the function
of the parameter:
Math.pow(x, 2)
function sqr(x:Number) {
return Math.pow(x, 2);
}
var y:Number = sqr(3);
trace(y); // output: 9
If the function is defined and used in the same script, the function definition may appear after
using the function:
var y:Number = sqr(3);
trace(y); // output: 9
function sqr(x:Number) {
return Math.pow(x, 2);
}
function
. When a script calls a function, the statements in the
arguments
object are creating a function that accepts a variable
arguments
- The name of the declared function.
sqr
with the specified
functionname
object in your function definition.
, which accepts one parameter and returns the
,
Statements
199

Advertisement

Table of Contents
loading

Table of Contents