Macromedia flex 2-migrating applications to flex 2 Manual De Usuario

Descargar
Página de 184
40
ActionScript 2.0 to 3.0
newstring2.prop = 1;
trace(newstring2.prop);
// prints '1' 
ActionScript 3.0:
newstring = new String("hello");
String.prototype.sayHi = function() {
trace("hi!");
}
newstring.sayHi();
newstring2 = "hello";
newstring2.prop = 1; 
// Warning, String is sealed...
String.prototype.prop = 1;
trace(newstring2.prop); 
// Output: 1
Working with keys
The Key class is now the Keyboard class.
doLater() method
The 
doLater()
 method on UIComponent has been removed. You now use 
callLater()
The 
callLater()
 method takes a similar number of arguments. You no longer specify the 
object on which the function to be called later is defined. In addition, because of stricter 
typing, you must remove quotes from around the function if you used them; the type is 
function and cannot be coerced from type String. For example:
Flex 1.5:
doLater(this, "moveText");
Flex 2:
callLater(moveText);
The 
callLater()
 method still takes an optional 
args
 argument. For more information, see 
ActionScript 3.0 Language Reference.
LocalConnection
The 
LocalConnection.allowDomain()
 method specifies one or more domains that can send 
LocalConnection calls to this LocalConnection instance. In previous versions of ActionScript, 
the 
allowDomain()
 method was a callback method that you implemented. In ActionScript 
3.0, 
allowDomain()
 is a built-in method of LocalConnection that you call. This makes the 
allowDomain()
 method work in much the same way as the 
Security.allowDomain()
 
method.