The
statement applies only to the current script (frame or object) in which it's called.
import
For example, suppose on Frame 1 of a Flash document you import all the classes in the
macr.util package. On that frame, you can reference classes in that package by their class
names instead of their fully qualified names. If you wanted to use the class name on another
frame script, however, you would need to reference classes in that package by their fully
qualified names or add an
that package.
When using
import
the level specified. For example, if you imported all classes in the mx.transitions package, only
those classes within the /transitions/ directory are imported, not all classes within
subdirectories (such as the classes in the mx.transitions.easing package).
If you import a class but don't use it in your script, the class isn't exported as part of the
SWF file. This means you can import large packages without being concerned about the
size of the SWF file; the bytecode associated with a class is included in a SWF file only if
that class is actually used.
About values and data types
Data, values, and types are important when you start writing classes and using them. You
learned about data and types in
work with classes, remember that data types describe the kind of information a variable or
ActionScript element can contain, such as Boolean, Number, and String. For more
information, see
"About data types" on page
Expressions have values, while values and properties have types. The values that you can set
and get to and from a property in your class must be compatible with that property. Type
compatibility means the type of a value is compatible with the type that is in use, such as the
following example:
var myNum:Number = 10;
For more information on strict data typing, see
typing" on page
81.
Object-oriented programming fundamentals
In the following sections, you will examine some of the terminology used throughout this
chapter before you start writing ActionScript code. This brief introduction to principles
involved in developing object-oriented programs helps you follow the examples and sections
within this chapter and the rest of this book. These principles are described in more depth in
the rest of this chapter, along with details on how they are implemented in Flash 8.
statement to the other frame that imports the classes in
import
statements, it's also important to note that classes are imported only for
Chapter 4, "Data and Data Types," on page
72.
"About assigning data types and strict data
About object-oriented programming and Flash
71. When you
231
Need help?
Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?
Questions and answers