174
Chapter 5: ActionScript Core Language Elements
import
Availability
Flash Player 6.
Usage
import
className
import
packageName
.*
Parameters
className
The fully qualified name of a class you have defined in an external class file.
packageName
A directory in which you have stored related class files.
Description
Keyword; lets you access classes without specifying their fully qualified names. For example, if you
want to use a custom class macr.util.users.UserClass in a script, you must refer to it by its fully
qualified name or import it; if you import it, you can refer to it by the class name:
// before importing
var myUser:macr.util.users.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 package (
working_directory
/macr/utils/users
) that you
want to access, you can import them all in a single statement, as shown in the following example:
import macr.util.users.*;
You must issue the
import
statement before you try to access the imported class without fully
specifying its name.
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.
For more information on importing, see
“Importing classes” on page 65
and
“Using packages”
on page 57
.
CHAPTER 5
ActionScript Core Language Elements
Summary of Contents for FLEX-FLEX ACTIONSCRIPT LANGUAGE
Page 1: ...Flex ActionScript Language Reference...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Page 135: ...case 135 See also break default strict equality switch...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Page 808: ...808 Chapter 7 ActionScript for Flash...
Page 810: ...810 Appendix A Deprecated Flash 4 operators...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Page 822: ...822 Index...