Example
The following example defines the function
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);
}
164
Chapter 5: ActionScript Core Language Elements
of the parameter:
, which accepts one parameter and returns the
sqr
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?