Else Statement - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

If you add an undeclared function,
example:
trace("");
craig.dance = true;
for (i in craig) {
trace("craig." + i + " = " + craig[i]);
}
/* output: **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 14: There is
no property with the name 'dance'. craig.dance = true; Total ActionScript
Errors: 1 Reported Errors: 1 */
Add the
keyword to the Person2 class, so that the first line appears as follows:
dynamic
dynamic class Person2 {
Test the code again, and you see the following output:
craig.dance = true craig.age = 32 craig.name = Craiggers
See also
class statement

else statement

if (condition){
statement(s);
} else {
statement(s);
}
Specifies the statements to run if the condition in the
braces (
) used to enclose the block of statements to be executed by the
{}
not necessary if only one statement will execute.
Availability: ActionScript 1.0; Flash Player 4
Parameters
condition:Boolean
dance
- An expression that evaluates to
, an error is generated, as shown in the following
statement returns
if
or
true
false
. The curly
false
statement are
else
.
Statements
205

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

This manual is also suitable for:

Flash 8

Table of Contents