MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 134

Actionscript language reference
Table of Contents

Advertisement

case
Availability
Flash Player 4.
Usage
case expression: statement(s)
Parameters
Any expression.
expression
statement(s)
Returns
Nothing.
Description
Statement; defines a condition for the
parameter of the
expression
execute statements in the
end of the
switch
If you use the
case
doesn't compile.
Note: You should always end the statement(s) parameter with a break statement. If you omit the
break statement from the statement(s) parameter, it continues executing with the next case
statement instead of exiting the switch statement.
Example
The following example defines conditions for the switch statement
equals the expression in the case statement, the statement executes.
var thisMonth:Number = new Date().getMonth();
switch (thisMonth) {
case 0 :
trace("January");
break;
case 1 :
trace("February");
break;
case 5 :
case 6 :
case 7 :
trace("Some summer month");
break;
case 8 :
trace("September");
break;
default :
trace("some other month");
}
134
Chapter 5: ActionScript Core Language Elements
ActionScript Core Language Elements
Any statement or sequence of statements.
switch
statement using strict equality (
switch
statement(s)
statement.
statement outside a
statement. If the
parameter until it encounters a
statement, it produces an error and the script
switch
CHAPTER 5
parameter equals the
expression
), then Flash Player will
===
statement or the
break
. If
thisMonth
thisMonth

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?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flex

Table of Contents