MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 147

Actionscript language reference
Table of Contents

Advertisement

dynamic
Availability
Flash Player 6.
Usage
dynamic class className
{
// class definition here
}
Description
Keyword; specifies that objects based on the specified class can add and access dynamic properties
at runtime.
Type checking on dynamic classes is less strict than type checking on nondynamic classes, because
members accessed inside the class definition and on class instances are not compared with those
defined in the class scope. Class member functions, however, can still be type checked for return
type and parameter types.
Subclasses of dynamic classes are also dynamic.
For more information, see
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:
// 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
*/
ActionScript Core Language Elements
[ extends superClass ]
[ implements interfaceName [, interfaceName... ] ]
"Creating dynamic classes" on page
has not yet been marked as dynamic, so calling an
Person2
CHAPTER 5
56.
dynamic
147

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flex

Table of Contents