Using External Files - Adobe FLEX 2-MIGRATING APPLICATIONS TO FLEX 2 Manual

Migrating applications to flex 2
Table of Contents

Advertisement

Using external files

This section describes changes to embedding, including, and importing external resources
with ActionScript in your Flex applications.
include
In ActionScript 2.0, the
use the keyword without the octothorp, and end the line with a semi-colon. For example:
ActionScript 2.0:
#include "../scripts/thescript.as"
ActionScript 3.0:
include "../scripts/thescript.as";
import
The
keyword lets you reference classes from other packages in your application. For
import
example, to use a
trace()
flash.util.trace class. The
import class;
For example:
import flash.util.trace;
You can optionally import entire packages using the wildcard syntax, as the following example
shows:
import flash.util.*;
However, best practices dictate that you only import the classes you need and not the entire
package. Doing so is better for performance and debugging.
ActionScript 3.0 uses a number of implicit imports to provide direct access to common global
functions such as
trace()
reduced. For more information, see
It is important to understand that you should import classes with an import statement rather
than use the full classname in your code. For example, do this:
import mx.formatters.*;
public var f:NumberFormatter = new NumberFormatter();
Rather than this:
public var f:mx.formatters.NumberFormatter = new
mx.formatters.NumberFormatter();
28
ActionScript 2.0 to 3.0
keyword was preceded by an octothorp:
include
statement in your custom ActionScript class, you import the
syntax is as follows:
import
. In ActionScript 3.0, the number of implicit imports has been
"Explicit imports" on page
. You now
#include
34.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex 2

Table of Contents