MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 99

Actionscript language reference
Table of Contents

Advertisement

Usage 2: The following example shows how to specify a function's parameter type by defining a
function named
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
?: (conditional)
Availability
Flash Player 4.
Usage
expression1 ? expression2 : expression3
Parameters
expression1
such as
.
x < 5
,
expression2
expression3
Returns
The value of
expression2
Description
Operator; instructs Flash to evaluate
returns the value of
For more information, see
Example
The following statement assigns the value of variable
evaluates to
true
var x:Number = 5;
var y:Number = 10;
var z = (x < 6) ? x: y;
trace (z); // returns 5
that takes a parameter named
randomInt()
An expression that evaluates to a Boolean value; usually a comparison expression,
Values of any type.
or
expression3
expression1
; otherwise it returns the value of
expression2
"Operator precedence and associativity" on page
:
integer
squareRoot()
val
.
, and if the value of
to variable
x
of type Number:
that takes a parameter
, also a Number type:
is
expression1
true
.
expression3
32.
because
z
expression1
?: (conditional)
, it
99

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flex

Table of Contents