Usage 2: The following example shows how to specify a function's parameter type by defining a
function named
randomInt()
function randomInt(integer:Number):Number {
return Math.round(Math.random()*integer);
}
trace(randomInt(8));
Usage 3: The following example defines a function named
named
of the Number type and returns the square root of
val
function squareRoot(val:Number):Number {
return Math.sqrt(val);
}
trace(squareRoot(121));
See Also
,
.
var
function
that takes a parameter named
of type Number:
integer
that takes a parameter
squareRoot()
, also a Number type:
val
: (type)
51
Need help?
Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?
Questions and answers