3.7 Datatype Information for Built-in Classes

 <  Day Day Up  >  

When working with static typing and ActionScript 2.0's built-in classes, you must observe the declared datatypes for each class. For example, if you store a TextFormat object in a typed variable, you must use the correct datatypes when assigning values to its properties. The following code generates an error because the TextFormat.align property requires a String , but a Boolean is used:

 var tf:TextFormat = new TextFormat( ); tf.align = true;  // Error! Boolean values not allowed. 

Unfortunately, Macromedia's documentation does not provide type information for the methods and properties of the built-in classes nor for the Flash MX 2004 components . For your benefit, the type information is listed in Appendix A.

Type information can also be retrieved from the source code of the classes in the installation folder for Flash MX 2004, as follows :

/Macromedia/Flash MX 2004/en/First Run/Classes

Component class definitions are found in the /mx/ directory, one directory below the /Classes/ directory listed previously.

Note that although source code for components is included in full, the built-in class definitions are intrinsic , meaning that they do not include method bodies or other implementation information. They do, however, contain datatype information as specified in Appendix A. For more details on intrinsic definitions, see Chapter 6.

 <  Day Day Up  >  


Essential ActionScript 2.0
Essential ActionScript 2.0
ISBN: 0596006527
EAN: 2147483647
Year: 2004
Pages: 177
Authors: Colin Moock

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net