Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Tài liệu The Classpath pptx
Nội dung xem thử
Mô tả chi tiết
< Day Day Up >
The Classpath
So far you have been introduced to the basics of the class syntax and creating a class file.
What you haven't yet learned is how class files relate to Flash authoring files—how
they're used in tandem.
If you want to use a custom class in a Flash project to create instances of that class, Flash
must know where to find its class file. This section explores how to instruct a Flash file to
load and use a custom class. As with many things in Flash, there are several techniques.
When compiling an SWF file from an FLA file, Flash checks to see whether you created
an instance of a custom class. If a custom class is being used, Flash attempts to load that
custom class to include it inside the SWF file. The directories in which Flash searches for
the class are called the classpath. If the class file is found within the classpath, the
compiler includes the class in the SWF. If the class file is not found, the compiler reports
an error.
Two classpaths are recognized when authoring an FLA file: one classpath is global, and
the other is at document level. The global classpath is the same no matter which FLA file
you're authoring. The document-level classpath can be changed for a specific FLA file
without affecting the classpaths seen by other FLA files.
The Global Classpath
By default, the global classpath points to two separate directories. The first is the
directory in which your current Flash document resides. For example, if you're editing an
FLA that's saved on your hard drive in a directory called MyTest, the MyTest directory is
recognized as a global classpath for that FLA. You can place class files used by your
project in that directory and Flash will find them. The global classpath also points to the
directory that contains the class files and interfaces for Flash's built-in classes.
NOTE
The global class directory can be found in the Flash MX 2004 program folder. On
Windows XP, it's in the following location:
Program Files\Macromedia\Flash MX 2004\en\First Run\Classes
Class files placed in this directory are immediately available for use by any FLA you
author.