XML Cache class

This is a class that I wrote quite a while back. It works just like Flash's XML Class, but if you try and load the same file / URL again, it will use the XML data stored in memory rather than reconnecting to the server.

Example:

Actionscript:
  1. import com.pixelbreaker.utils.XMLCache;
  2.  
  3. myXML = new XMLCache();
  4. myXML.load( 'anXMLfile.xml' ); // will load the file in
  5.  
  6. myXML2 = new XMLCache();
  7. myXML2.load( 'anXMLfile.xml' ); // will use previously loaded data.

The idea is simple, the XMLCache class extends XML, and has a static object called xmlCache, whenever an XML file is loaded, it's stored in the static object with the name exactly representative of the full filename/path passed to the load() method, then whenever it's called again, the data is pulled from the static object. Easy peasy!

Download it here.

No comments yet. Be the first.

Leave a reply

*
To prove that you're not a bot, enter this code
Anti-Spam Image