Adobe FLEX 2-MIGRATING APPLICATIONS TO FLEX 2 Manual page 33

Migrating applications to flex 2
Table of Contents

Advertisement

Type detection
To perform type detection, you should use
function examines types, whereas the
function has been deprecated.
instanceof
For example:
class B {
public function B() {}
}
class A extends B {
public function A() {
super();
}
}
class Main extends MovieClip {
public function Main() {
var a:A = new A();
trace(a instanceof B); // false; instanceof is deprecated.
trace(a instanceof A); // false; instanceof is deprecated.
trace(a is B); // true
trace(a is A); // true
}
}
Primitive types
In ActionScript 3.0, there is no longer a distinction between primitive types such as strings
and instances of the String class. All strings are instances of String; every datatype is an
instance of some class. The same is true for numbers and Booleans. For example:
print("test" == String("test"));
print("test" === String("test"));
print(45 == new Number(45));
print(45 === new Number(45));
print("one;two;three".substring(4,7)); // "two"
print((255).toString(16));
Non-assignment expressions
A non-assignment expression is any expression where a value is not assigned to a property (or
a variable or argument); for example:
var myVar : hintString ? String : Number;
rather than
is
typeof
function looks at the prototype chain. The
instanceof
// true
// true
// true
// true
// "ff"
or
. The
instanceof
Typing
is
33

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex 2

Table of Contents