case statement
case expression : statement(s)
Defines a condition for the
parameter of the
expression
will execute statements in the
or the end of the
switch
If you use the
statement outside a
case
doesn't compile.
Note: You should always end the
omit the
break statement
the next
statement instead of exiting the
case
Availability: ActionScript 1.0; Flash Player 4
Parameters
expression:String
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");
}
See also
break statement
statement. If the
switch
statement using strict equality (
switch
statement(s)
statement.
switch
statement(s)
from the
statement(s)
- Any expression.
expression
parameter until it encounters a
statement, it produces an error and the script
parameter with a break statement. If you
parameter, it continues executing with
statement.
switch
parameter equals the
), then Flash Player
===
statement
break
. If
thisMonth
thisMonth
Statements
195
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?