Step 5: Import Classes For Package-Level Functions; Step 6: Put All Actionscript Components In Packages - Adobe FLEX 2-MIGRATING APPLICATIONS TO FLEX 2 Manual

Migrating applications to flex 2
Table of Contents

Advertisement

Step 5: Import classes for package-level
functions
When you use package-level functions, you must import the package. For example, in Flex 1.x
you could call the
show()
mx.controls.Alert.show("This is an Alert!");
In Flex 2, you must import the package before calling the function, as the following example
shows:
import mx.controls.Alert;
Alert.show("This is an Alert!");
Step 6: Put all ActionScript components
in packages
You must wrap all ActionScript components in a
is located in the same directory as the main application. If the component is in the same
directory as the main application, you can use an unnamed package, but the
statement must be the first line of the component's file; for example:
package {
public class MyClass {
// Class definition
}
} // Close package
Adobe recommends that you use unique package names so that there are no duplicate class
names in your source paths. The generally accepted syntax is to use the reverse URL
technique; for example:
com.yourcompany.MyPackage
Package names must match the directory hierarchy. For example, if you have the following
component used by your main application:
/myfiles/MainApp.mxml
/myfiles/mycomponents/TrivialComponent.mxml
Your package name must be mycomponents, as the following example shows:
package mycomponents {
...
}
For more information about the
on page
26.
method in the following way:
statement syntax, see
package

Step 6: Put all ActionScript components in packages

statement, even if the component
package
"Package statement syntax"
package
17

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex 2

Table of Contents