User Guide
228 ActionScript language elements
Returns
Both forms invoke a function. The function may return any value.
Parameters
method:Function - The method to invoke in the superclass.
argN - Optional parameters that are passed to the superclass version of the method (syntax 1)
or to the constructor function of the superclass (syntax 2).
switch statement
switch (expression){
caseClause:
[defaultClause:]
}
Creates a branching structure for ActionScript statements. As with the if statement, the
switch statement tests a condition and executes statements if the condition returns a value
of
true. All switch statements should include a default case. The default case should include a
break statement that prevents a fall-through error if another case is added later. When a case
falls through, it doesn't have a break statement.
Availability: ActionScript 1.0; Flash Player 4
Parameters
expression - Any expression.
Example
In the following example, if the
String.fromCharCode(Key.getAscii()) parameter
evaluates to
A, the trace() statement that follows case "A" executes; if the parameter
evaluates to
a, the trace() statement that follows case "a"executes; and so on. If no case
expression matches the
String.fromCharCode(Key.getAscii()) parameter, the trace()
statement that follows the
default keyword executes.
var listenerObj:Object = new Object();
listenerObj.onKeyDown = function() {
switch (String.fromCharCode(Key.getAscii())) {
case "A" :
trace("you pressed A");
break;
case "a" :
trace("you pressed a");
break;
case "E" :
case "e" :