Sunday, 5 February 2012

Asset Manager


Right so I made a couple of classes for the asset management tool.  I'm going to host all the code on Google Code at some point but I can't be arsed at the moment (too cold perhaps?).  Instead I'll just run through the basics.

So the bits I thought I needed were :
  • Determine whether to use the URLLoader for data (xml, text, etc) or the Loader for swf's and images.
  • Allow access to loaded data and encapsulate the getDefinitionByName function
  • Unload assets that are no longer required (Garbage Collection, yuk)
  • Queue loads
  • Report load progress, handle errors and complete events
Out of the 5 I managed to do 3, I didn't bother with the getDefinitionByName just yet because it's mainly used to grab graphical assets from Flash files which I won't be using any time soon.

I also didn't bother with the unloading of assets because again the main purpose of this is to unload load graphics swf's to free up memory. I won't really need to do that with bitmaps and handling the disposal of those is much easier.

There are only two classes; AssetManager and AssetLoader.  The AssetManager simply instantiates an AssetLoader and adds it to a loadQueue.  The AssetLoader determines what type of file is being loaded (from the extension of the URL), loads the file reporting the progress (as a trace only at the moment) and then executes a callback.  Pretty basic but hopefully a solid base to start on, adding to it when necessary.

Ok so I'll create a google code account some time later on because talking about it is rubbish...

Next on the list : SpriteSheet handling!

No comments:

Post a Comment