Alright.
The functions to load or send data with XML in AS3 are quite similar to AS2. So there'll be no major issues. First I'll explain you the basics:
Of course, you must write the code in some frame in the main timeline.
To load any external fine in AS3 you no longer hace the loadVars, you have the URLLoader, and to use it, you need to import the class.
Suppose you have an XML like this one:
<news>
<article>
<title>Title</title>
<content><![CDATA[The article's content here]]></content>
</article>
</news>
-
//These are the classes you will need to import
-
import flash.events.*;
-
import flash.net.URLLoader;
-
import flash.net.URLRequest;
-
import flash.xml.*;
-
import flash.errors.*;
-
-
var _xml:XML; //I made it global, so if you need to use it in various functions it will be available
-
-
//to load the XML create an instance of the URLLoader:
-
var _loader:URLLoader = new URLLoader();
-
var _req:URLRequest = new URLRequest('http://www.yourdomain.com/thefile.xml');
-
_loader.addEventListener(Event.COMPLETE, onComplete);
-
_loader.load(_req);
-
-
function onComplete(e:Event):void {
-
_xml = _loader.data;
-
//here you can start parsing your XML with the newly introduce E4X (ECMAScript For XML)
-
}
-
To send data to an external script, you can do it the same way, but first decalring the method for the request, like this:
_req.method = URLRequestMethod.POST; for example
and declaring the format for the loader to text, so you can send the XML as text:
_loader.DataFormat = URLLoaderDataFormat.TEXT;
Check this article I found, it explains this very well:
http://livedocs.adobe.com/flex/201/h...ons_173_2.html
Best regards,
The_Nephilim
AS3 would be fine at this point especially if it will be easier to deal with, but AS2 would not be a major issue either.
Yes, I have to send them a string populated by a few input fields. Once they get it I will get another string back from them with all of the rate information.
Thanks,
rrocket