7Nov/090
Convert a Xml to an ArrayCollection in AS3
Here is a quick method to convert a xml to an array collection. Because you pass the XML url (Eg: './assets/data.xml') to the first argument you will receive the array asynchronous using the callback function. If you have already the xml content in a variable use only the code in the anonymous function at the event.COMPLETE dispatch.
static public function convertXmlToArrayCollection( xmlUrl:String, rootTag:String, repeatedElement:String, callback:Function ):void
{
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, function(e:Event):void
{
var xml:XMLDocument = new XMLDocument( e.target.data );
xml.ignoreWhite = true;
var decoder:SimpleXMLDecoder = new SimpleXMLDecoder();
var data:Object = decoder.decodeXML( xml );
var array:Array= ArrayUtil.toArray(data[rootTag][repeatedElement]);
callback(new ArrayCollection( array ));
});
xmlLoader.load(new URLRequest(xmlUrl));
}
6Oct/090
Great day for Flex/Flash Developers
Today at Max 2009 Adobe announced the ability to build iPhone application with action script 3. Multitouch api and other were added to flash so developers could take advantage of the iPhone features. By the end of this year Adobe promised to release the tools required and personally I can't wait to create my first flash iPhone app.
You can find more information on the adobe labs.