Accessing application scope
Every class that extends the UIObject class has an
the Application object. You can use this property to access data or methods at the application
level. Because the event handlers and the bindings of a component execute in the context of that
component, using the Application object gives you access to the application scope.
To access the Application object, you must import the Application package in your class file, as
the following example shows:
import mx.core.Application;
Some nonvisual components, such as Validator, do not inherit from the UIObject class. As a
result, some components do not have an
access the application by using the static property
In the following example, the component calls the
Assume that the method is written in the MXML file or some dependent class that uses your
component.
var name:String = application.getName();
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 following table describes these variables:
Property
Type
symbolName
String
symbolOwner
Object Class used in the internal call to the
String
className
50
Chapter 3: Creating Advanced Components in Flash MX 2004
application
,
symbolName
symbolOwner
Description
Symbol name for the object (name of the ActionScript class). The symbol
name must be the fully qualified class name (for example,
myPackage.MyComponent).
This name must match the Linkage Identifier and ActionScript 2.0 Class
fields in the Create New Symbol dialog box described in
symbols" on page
12.
You must declare this variable as static.
The symbol owner must be the fully qualified class name (for example,
myPackage.MyComponent).
Do not use quotation marks around the
Object.
This name must match the Linkage Identifier and ActionScript 2.0 Class
fields in the Create New Symbol dialog box described in
symbols" on page
12.
You must declare this variable as static.
Name of the component class. This does not include the package name
and has no corresponding setting in the Flash development environment.
You can use the value of this variable when setting style properties.
property that stores a reference to
application
property. For these components, you can
Application.application
method on the Application object.
getName()
, and
variables in your
className
createClassObject()
symbolOwner
.
"Adding new
method.
value, since it is of type
"Adding new
Need help?
Do you have a question about the FLEX - DEVELOPING COMPONENTS AND THEMES and is the answer not in the manual?
Questions and answers