MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual page 660

Actionscript reference guide
Hide thumbs Also See for FLASH MX 2004 - ACTIONSCRIPT:
Table of Contents

Advertisement

Description
Statement; creates a branching structure for ActionScript statements. Like the
action tests a condition and executes statements if the condition returns a value of
switch
Example
In the following example, if the
executes, if the
case 1
executes, and so on. If no
that follows the
switch (number) {
case 1:
trace ("case 1 tested true");
break;
case 2:
trace ("case 2 tested true");
break;
case 3:
trace ("case 3 tested true");
break;
default:
trace ("no case tested true")
}
In the following example, there isn't a break in the first case group so if the number is 1, both A
and B are sent to the Output panel:
switch (number) {
case 1:
trace ("A");
case 2:
trace ("B");
break;
default:
trace ("D")
}
See also
=== (strict equality)
660
Chapter 12: ActionScript Dictionary
number
parameter evaluates to 2, the
number
expression matches the
case
keyword executes.
default
,
,
break
case
parameter evaluates to 1, the
trace()
number
,
,
default
if
action, the
if
action that follows
trace()
action that follows
parameter, the
trace()
.
true
case 2
action

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents