MACROMEDIA FLASH MX 2004-USING COMPONENTS Use Manual page 933

Using components
Hide thumbs Also See for FLASH MX 2004-USING COMPONENTS:
Table of Contents

Advertisement

Importing classes
You can import class files so that you don't have to write fully qualified class names throughout
your code. This can make code more concise and easier to read. To import a class, use the
statement at the top of the class file, as in the following:
import mx.core.UIObject;
import mx.core.ScrollView;
import mx.core.ext.UIObjectExtensions;
class MyComponent extends UIComponent{
You can also use the wildcard character (*) to import all the classes in a given package. For
example, the following statement imports all classes in the
import mx.core.*;
If an imported class is not used in a script, the class is not included in the resulting SWF file's
bytecode. As a result, importing an entire package with a wildcard does not create an
unnecessarily large SWF file.
Defining the class and its superclass
A component class file is defined like any class file. Use the
name. The class name must also be the name of the class file. Use the
indicate the superclass. For more information, see Chapter 10, "Creating Custom Classes with
ActionScript 2.0," in Using ActionScript in Flash.
class MyComponentName extends UIComponent{
}
Identifying the class, symbol, and owner names
To help Flash find the proper ActionScript classes and packages and to preserve the component's
naming, you must set the
component's ActionScript class file.
The
symbolOwner
own
symbolOwner
qualified.
,
symbolName
symbolOwner
variable is an Object reference that refers to a symbol. If the component is its
or is the
symbolOwner
mx.core
class
, and
className
has been imported, it does not have to be fully
Creating the ActionScript class file
package:
keyword to indicate the class
keyword to
extends
variables in your
import
933

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

This manual is also suitable for:

Flash mx

Table of Contents