MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual page 401

Actionscript reference guide
Hide thumbs Also See for FLASH MX 2004 - ACTIONSCRIPT:
Table of Contents

Advertisement

Description
Keyword; lets you access classes without specifying their fully qualified names. For example, if you
want to use the class macr.util.users.UserClass.as in a script, you must either refer to it by its fully
qualified name or import it; if you import it, you can then refer to it by the class name:
// before importing
var myUser:UserClass = new macr.util.users.UserClass();
// after importing
import macr.util.users.UserClass;
var myUser:UserClass = new UserClass();
If there are several class files in the directory that you want to access, you can import them all in a
single statement:
import macr.util.users.*;
You must issue the
specifying its name.
If you import a class but then 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 worrying about the size of your SWF file;
the bytecode associated with a class is included in a SWF file only if that class is actually used.
The
statement applies only to the current script (frame or object) in which it's called. For
import
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 simple names.
// On Frame 1 of a FLA:
import macr.util.*;
var myFoo:foo = new foo();
On another frame script, however, you would need to reference classes in that package by their
fully qualified names (
to the other frame, as well, that imports the classes in that package.
For more information on importing, see
on page
171.
#include
Availability
Flash Player 4.
Usage
#include "[path] filename.as"
Note: Do not place a semicolon (;) at the end of the line that contains the #include statement.
Parameters
[path] filename.as
panel; .as is the recommended file extension.
Returns
Nothing.
statement before you try to access the imported class without fully
import
var myFoo:foo = new macr.util.foo();
The filename and optional path for the script to add to the Actions
"Importing classes" on page 171
) or add an
statement
import
and
"Using packages"
#include
401

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?

Questions and answers

Table of Contents