This has been very straight forward:
The code has been working under FLEX (AS2.0) SDK. However, when running it under FLEX2.0 SDK, I was shocked with the following exception ! : “onLoad property does not exist for object ..” After looking at the FLEX2.0 changes here , it turned out that the XML class has been renamed to XMLDocument and moved under another package (flash.xml) to avoid conflict with the new top-level XML class that implements ECMAScript for XML (E4X).var login_str:String = "valid xml that contains user info";
var my_xml:XML = new XML(login_str);
var myLoginReply_xml:XML = new XML();
myLoginReply_xml.onLoad = myOnLoad;
my_xml.sendAndLoad("servletURL", myLoginReply_xml);
function myOnLoad(success:Boolean) {
//extract reply message from myLoginReply_xml object
if (success)
{
}
else
{
}}
Not only the class has been moved and renamed, but also it was dramatically changed. For example the sendAndLoad method now does not exist!, and of course the onLoad property that used to set the event handler for the "load" event has been removed (since the new event model of FLEX2.0 now took place, and events could be only set via the addEventListener method).
Now for me to retain the functionality of the above few lines of code, i have to use a combination of 3 classes: URLLoader, URLRequest and of course the new XMLDocument class (The details will be posted in a later post).
The funny thing is that Adobe claims they made the XMLDocument class for backward compatibility with AS2.0 code, horray!
No comments:
Post a Comment