MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference page 204

Actionscript 2.0 language reference
Table of Contents

Advertisement

Subclasses of dynamic classes are also dynamic.
Be sure to specify the type when declaring an object, as in the following:
var x:MyClass = new MyClass();
If you do not specify the type when declaring an object (as in the following) then the object is
considered dynamic:
var x = new MyClass();
Availability: ActionScript 2.0; Flash Player 6
Example
In the following example, class
undeclared function on it generates an error at compile time:
class Person2 {
var name:String;
var age:Number;
function Person2(param_name:String, param_age:Number) {
trace ("anything");
this.name = param_name;
this.age = param_age;
}
}
In a FLA or AS file that's in the same directory, add the following ActionScript to Frame 1 on
the Timeline:
// Before dynamic is added
var craig:Person2 = new Person2("Craiggers", 32);
for (i in craig) {
trace("craig." + i + " = " + craig[i]);
}
/* output:
craig.age = 32
craig.name = Craiggers */
204
ActionScript language elements
has not yet been marked as dynamic, so calling an
Person2

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?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF