refactoring

Spent last night refactoring the AssetLoader. It looks a lot better stripped down. I have also removed the typed getter methods from the IAssetContainer. You know the fileType, you know the clientLoaderType, so it can be typed after a call to the getAsset():* method. The only asset type this really affects is XML. Basically, you can’t store XML in the AssetLoader, it can only be stored in its serialised state (ie a String). This means that once it is loaded it must be retrieved, parsed, and injected into its very own model for storage and access. But that’s only good practise – no??

The reason I’m not parsing XML within the AssetLoader is because you might want to set some of the static XML parsing properties first. This is one of the main reasons that I stopped using BulkLoader.

I have added a few smaller interfaces:

ICreate
which is basically a factory method that wraps a Module or SWF asset. The create(id:String=””) method can be called on them, allowing access to classes embedded in the assets.

IDeconstruct
this enforces the good practice of disposing of assets properly. An IDeconstructor that knows how to handle a specific asset’s deconstruction wraps the asset and is passed into the ILoadInfo at the completion of a successful load. So a NetStream or a Bitmap can be handled in their own unique ways.

Leave a Reply

Your email address will not be published. Required fields are marked *