Step 3: Add Types - Adobe FLEX 2-MIGRATING APPLICATIONS TO FLEX 2 Manual

Migrating applications to flex 2
Table of Contents

Advertisement

The default access modifier for methods, variables, and classes is
all classes in the same package can access them, but classes outside of the package cannot.
However, the Flex compiler issues a warning if you do not specify any access modifier.
For more information about access modifiers, see
information about disabling warnings, see Chapter 9, "Using the Flex Compilers," in Building
and Deploying Flex 2 Applications.

Step 3: Add types

All variables, properties, method arguments, and method return types should now be typed.
To find variables and properties, search for the keyword "var" to locate places where you
should type variables and properties.
The following table shows common variable typing tasks:
Flex 1.x
var s = "Title Page";
var myType = event.type;
item = event.target.selectedItem;
public function
myHandler(event):void
To find methods and method arguments, search for the keyword
type if that method returns a value and type each method argument; for example:
Flex 1.x:
function getAnswer(myString) {
...
return myString;
}
Flex 2:
public function getAnswer(myString:String):String {
...
return myString;
}
For more information, see
Flex 2
public var s:String = "Title Page";
public var myType:String =
String(event.type);
item =
ThumbnailView(event.target.selectedItem);
public function myHandler(event:Event):void
"Explicit typing" on page
internal
"Access modifiers" on page
function
32.
. This means that
27. For
and add a return

Step 3: Add types

15

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex 2

Table of Contents