MACROMEDIA FLEX 2-MIGRATING APPLICATIONS TO FLEX 2 Manual do Utilizador Página 15

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 184
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 14
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 Access modifiers” on page 27. 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 “Explicit typing” on page 32.
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
Vista de página 14
1 2 ... 10 11 12 13 14 15 16 17 18 19 20 ... 183 184

Comentários a estes Manuais

Sem comentários