' 08 October, 07 - 2:34 am
Stable Release XMLLoader 2.0
**Update**
http://blog.kreativeking.com/2008/10/xmlloader-20-updatexmlloader-20-update/
I have been working hard on making this as robust and stable as possible. This release should be able to do anything you would like with loading XML. Couple of new features from 1.8 the community has been emailing me about as well as some that I wanted to include in past versions. I will be releasing a video tutorial on how to use this class properly. I’ll explain the new features to hold you over until then.
New Constructor
XMLLoader($url:Array = null, $cache:Boolean = false):void
In 2.0, the XMLLoader constructor now takes 2 parameters. The first, being the same as in past versions, an Array of the xml files being loaded. The second being a new feature called cacheBuster which I will get more into bit later. By default these are set to null and false respectively.
New Cachebuster Feature
XmlLoader 2.0 introduces the new Cachebuster feature. This feature allows you to always load up an up to date version of your XML File. This is will make it so your flash application will not used cached files. This parameter is takes a boolean value and can be set in two ways. One being in the constructor shown above. The second is by setting the cacheBuster property.
XMLLoader.cacheBuster = true; XMLLoader.cacheBuster =false;
New way of referencing load XML’s
In past versions, to access a certain loaded XML file. Something like the code below would be used.
XMLLoader.getList["xmlfile.xml"];
In 2.0 the file extension is no longer accepted, just the name of the file like below.
XMLLoader.getList["xmlfile"];
Also in 2.0, if you have two loaded files that happen to have the same name. To access the other files after the first. You only need to put the name + underscore + array index. Here is an example.
var testXML:XMLLoader = new XMLLoader(["test.xml", "test2.xml", "test.xml", "test2.xml", "test.xml", "test2.xml"], true); testXML.addEventListener(Event.COMPLETE, doIT); function doIT(e:Event) { var list:XML; list = testXML.getList["test_4"]; trace(list); }
In the above code, the last test.xml will be loaded. The array index is its spot in the url array.
Those are the main new features in 2.0. Some other under the hood work includes some better error catching and proper event dispatching. The video tutorial should be out before the month is out as well as a new ite to host them, so look out for that. As always, let me know of any bugs and suggestions nd I will try to get to them ASAP.
Enjoy
No related posts.
Feed Me
Feed Me via Email
Follow Me on Twitter
I'm LinkedIn





Comments