Packagenet.guttershark.preloading
Classpublic class AssetLibrary
ImplementsIDisposable

The AssetLibrary is a singleton that stores all assets loaded by any PreloadController.

See also

PreloadController class


Public Methods
 MethodDefined by
  
addAsset(libraryName:String, obj:*):void
Register an asset in the library.
AssetLibrary
  
dispose():void
Purge all assets from the library.
AssetLibrary
  
getAsset(libraryName:String):*
A generic method to get any asset from the library.
AssetLibrary
  
getBitmap(libraryName:String):Bitmap
Get a loaded asset as a Bitmap.
AssetLibrary
  
getBitmapFromSWFLibrary(libraryName:String, bitmapLinkageId:String):Bitmap
Get a Bitmap from a swf library.
AssetLibrary
  
getClassFromSWFLibrary(libraryName:String, classNameInLibrary:String):Class
Get a Class reference from a swf library.
AssetLibrary
  
getFontFromSWFLibrary(libraryName:String, fontLinkageId:String):Font
Get an embedded Font from a SWF library.
AssetLibrary
  
getMovieClipFromSWFLibrary(libraryName:String, classNameInLibrary:String):MovieClip
Get a movie clip from a swf library.
AssetLibrary
  
getSound(libraryName:String):Sound
Get a Sound asset.
AssetLibrary
  
getSoundFromSWFLibrary(libraryName:String, soundLinkageId:String):Sound
Get a Sound from a swf library
AssetLibrary
  
getSpriteFromSWFLibrary(libraryName:String, classNameInLibrary:String):Sprite
Get a sprite from a swf library.
AssetLibrary
  
getSWF(libraryName:String):Loader
Get a SWF asset from the library.
AssetLibrary
  
getXML(libraryName:String):XML
Get an XML asset.
AssetLibrary
  
[static] Singleton Instance.
AssetLibrary
  
isAvailable(libraryName:String):Boolean
Check to see if an asset is available in the library.
AssetLibrary
  
removeAsset(libraryName:String):void
Remove an asset from the library.
AssetLibrary
Method detail
addAsset()method
public function addAsset(libraryName:String, obj:*):void

Register an asset in the library.

Parameters
libraryName:String — The item id.
 
obj:* — The loaded asset object.

Throws
— If libraryName is null.
 
— If obj is null.
dispose()method 
public function dispose():void

Purge all assets from the library. The AssetLibrary is still usable after a dispose, just the assets are disposed of.

getAsset()method 
public function getAsset(libraryName:String):*

A generic method to get any asset from the library.

Parameters
libraryName:String — The library name used when the asset was registered.

Returns
* — The asset is returned un-typed.

Throws
— If the inZipLibrary specified was not a zip registered in the library.
 
— If the asset was not registered in the library.
getBitmap()method 
public function getBitmap(libraryName:String):Bitmap

Get a loaded asset as a Bitmap.

Parameters
libraryName:String — The library name used when the asset was registered.

Returns
Bitmap — Bitmap returns a flash.display.Bitmap asset.
getBitmapFromSWFLibrary()method 
public function getBitmapFromSWFLibrary(libraryName:String, bitmapLinkageId:String):Bitmap

Get a Bitmap from a swf library.

Parameters
libraryName:String — The library name used when the asset was registered.
 
bitmapLinkageId:String — The bitmaps linkage Id.

Returns
Bitmap — Bitmap Returns a Font instance.
getClassFromSWFLibrary()method 
public function getClassFromSWFLibrary(libraryName:String, classNameInLibrary:String):Class

Get a Class reference from a swf library.

Parameters
libraryName:String — The library name used when the asset was registered.
 
classNameInLibrary:String — The class name in the loaded swf's library.

Returns
Class — MovieClip Returns the asset as a MovieClip
getFontFromSWFLibrary()method 
public function getFontFromSWFLibrary(libraryName:String, fontLinkageId:String):Font

Get an embedded Font from a SWF library. The Font is also registered through Font.registerFont before it's returned.

Parameters
libraryName:String — The library name used when the asset was registered.
 
fontLinkageId:String — The font linkage id.

Returns
Font — Font Returns a Font instance.
getMovieClipFromSWFLibrary()method 
public function getMovieClipFromSWFLibrary(libraryName:String, classNameInLibrary:String):MovieClip

Get a movie clip from a swf library.

Parameters
libraryName:String — The library name used when the asset was registered.
 
classNameInLibrary:String — The class name in the loaded swf's library.

Returns
MovieClip — MovieClip Returns the asset as a MovieClip
getSound()method 
public function getSound(libraryName:String):Sound

Get a Sound asset.

Parameters
libraryName:String — The library name used when the asset was registered.

Returns
Sound — Sound returns a flash.media.Sound instance.
getSoundFromSWFLibrary()method 
public function getSoundFromSWFLibrary(libraryName:String, soundLinkageId:String):Sound

Get a Sound from a swf library

Parameters
libraryName:String — The library name used when the asset was registered.
 
soundLinkageId:String — The sounds linkage id from the library.

Returns
Sound — Sound Returns a Sound instance.
getSpriteFromSWFLibrary()method 
public function getSpriteFromSWFLibrary(libraryName:String, classNameInLibrary:String):Sprite

Get a sprite from a swf library.

Parameters
libraryName:String — The library name used when the asset was registered.
 
classNameInLibrary:String — The class name in the loaded swf's library.

Returns
Sprite — Sprite Returns the asset as a MovieClip
getSWF()method 
public function getSWF(libraryName:String):Loader

Get a SWF asset from the library.

The asset is cast as a Loader class

Parameters
libraryName:String — The library name used when the asset was registered.

Returns
Loader — Loader Returns the asset as a Loader.

See also

Loader class
getXML()method 
public function getXML(libraryName:String):XML

Get an XML asset.

Parameters
libraryName:String — The library name used when the asset was registered.

Returns
XML — XML returns the XML instance.
gi()method 
public static function gi():AssetLibrary

Singleton Instance.

Returns
AssetLibrary
isAvailable()method 
public function isAvailable(libraryName:String):Boolean

Check to see if an asset is available in the library.

Parameters
libraryName:String — The libraryName used to register the asset.

Returns
Boolean — Boolean
removeAsset()method 
public function removeAsset(libraryName:String):void

Remove an asset from the library.

Parameters
libraryName:String — The asset's libraryName to remove.

Throws
— If libraryName is null.