Macromedia flex 2-migrating applications to flex 2 User Manual

Page of 184
Step 3: Add types
15
The default access modifier for methods, variables, and classes is 
internal
. This means that 
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 
. For 
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:
To find methods and method arguments, search for the keyword 
function
 and add a return 
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 1.x
Flex 2
var s = "Title Page";
public var s:String = "Title Page";
var myType = event.type;
public var myType:String = 
String(event.type);
item = event.target.selectedItem;
item = 
ThumbnailView(event.target.selectedItem);
public function 
myHandler(event):void
public function myHandler(event:Event):void