Function literals have the same syntax as standard function
declarations except that the function name is omitted and
there's a semicolon after the statement block. The general form
is:
function (param1, param2, ... paramn) { statements };
where param1,param2,...paramn is an
optional list of parameters and statements
is one or more statements that constitute the function body. Because
it doesn't include a function name, a function literal is
"lost" unless we store it in a variable (or an array
element or object property). We can store a function literal in a
variable for later access, like this:
// Store a function literal in a variable
var mouseCoords = function ( ) { return [ _xmouse, _ ymouse ]; };
// Now we can execute the function
mouseCoords( );
Note that because ActionScript does not support JavaScript's
Function( ) constructor, dynamic functions
cannot be composed at runtime, as they can in JavaScript.
 |  |  |
9.4. Exiting and Returning Valuesfrom Functions |  | 9.6. Function Availability and Life Span |