kreativeKING - Interactive Developer

Posts tagged “XMLLoader”

Now a PUBLISHED AUTHOR

I was looking in Barnes and Noble, checking out the usual magazines I always do. I happen to come across the new Flash and Flex magazine and take a look at the table of contents to see my name in bold letters. To say I was excited would be an understatement. I completely forgot that I submitted an article to FFD introducing my XMLLoader Class. Its a very good article and tutorial and I suggest anyone t check it out. Another well known author in this issue is, flash community guru, Lee Brimelow. It feels good to actually see your name in a magazine. Hopefully it will not be the last.

XML Based Navigation

Just something I whipped up trying to build up my portfolio of web elements. This navigation element grabs the urls from an xml file, so you can update the links without having to open the flash file for fast updating of links. Any questions drop me a line.


[kml_flashembed movie=”http://blog.kreativeking.com/downloads/examples/navs/nav1.swf” height=”157.5” width=”560” base=”http://blog.kreativeking.com/downloads/examples/navs/” /]

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



Download XMLLoader Class 2.0 Here

More Information