Migrating existing applications to Flash Remoting for Flash MX 2004 ActionScript 2.0
23
5.
Adjust for and adhere to case sensitivity in ActionScript 2.0.
ActionScript 2.0 is case sensitive. For example,
myVar
and
myvar
were treated as the same
variable in ActionScript 1.0 but they are treated as two distinct variables in ActionScript 2.0:
var myVar:Object = new Object();
var temp:Object = myvar;
trace(temp); // will print undefined
6.
Change
*_result
method names to
*_Result
. For example, you must change a method
named
getCategories_result()
to
getCategories_Result().
7.
Adhere to the following ActionScript 2.0 restrictions:
■
Do not increment an undefined value. Whereas incrementing an undefined value in
ActionScript 1.0 would set it to 1, doing so in ActionScript 2.0 will return "undefined".
■
In ActionScript 2.0, the expression
Boolean("String")
will return
true
and
Boolean("")
will return
false
. In ActionScript 1.0, however,
Boolean("String")
returned
false
and
Boolean("1234")
returned
true
.
■
The
Object.constructor
property must appear only on prototype objects.
8.
Change calls to the
NetServices.setDefaultGatewayURL
function to
NetServices.setDefaultGatewayUrl
. Note the case difference between
URL
and
Url
.
For an example of an Action 1.0 Flash Remoting example that has been converted with minimal
changes to comply with ActionScript 2.0, see
“Migrating the DataGrid application to Flash
Remoting for Flash MX 2004 ActionScript 2.0” on page 24
.
Taking full advantage of Flash Remoting for Flash MX 2004 ActionScript 2.0
To take full advantage of Flash Remoting for Flash MX 2004 ActionScript 2.0, you should make
the following changes to your existing applications in addition to making the changes noted in
the previous section:
•
Use the new Flash Remoting API classes and methods:
■
Service class
■
PendingCall class
■
RelayResponder class
■
ResultEvent and FaultEvent classes
■
The new methods of the RecordSet class, including
clear()
,
contains()
,
editField()
,
getEditingData()
,
getIterator()
,
getLocalLength()
,
getRemoteLength()
,
isEmpty()
,
sortItems()
and
sortItemsBy()
methods.
•
Consider using the RemotingConnector component.
•
Adhere to strict data typing.