Packagenet.guttershark.managers
Classpublic final class AssetManager

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

See also

PreloadController Class


Public Properties
 PropertyDefined by
  lastLibraryName : String
[read-only] The last libraryName that was used to register an object.
AssetManager
Public Methods
 MethodDefined by
  
addAsset(libraryName:String, obj:String, source:* = null):void
Register an asset in the library.
AssetManager
  
dispose():void
Purge all assets from the library.
AssetManager
  
getAsset(libraryName:String):*
A generic method to get any asset from the library.
AssetManager
  
getBitmap(libraryName:String):Bitmap
Get a loaded asset as a Bitmap.
AssetManager
  
getBitmapFromSWFLibrary(libraryName:String, bitmapLinkageId:String):Bitmap
Get a Bitmap from a swf library.
AssetManager
  
getClassFromSWFLibrary(libraryName:String, classNameInLibrary:String):Class
Get a Class reference from a swf library.
AssetManager
  
getFLV(libraryName:String):FLV
Get an flv instance.
AssetManager
  
getFontFromSWFLibrary(libraryName:String, fontLinkageId:String):Font
Get an embedded Font from a SWF library.
AssetManager
  
getMovieClipFromSWFLibrary(libraryName:String, classNameInLibrary:String):MovieClip
Get a movie clip from a swf library.
AssetManager
  
getNetStream(libraryName:String):NetStream
Get a net stream that was used to load an flv.
AssetManager
  
getSound(libraryName:String):Sound
Get a Sound asset.
AssetManager
  
getSoundFromSWFLibrary(libraryName:String, soundLinkageId:String):Sound
Get a Sound from a swf library
AssetManager
  
getSpriteFromSWFLibrary(libraryName:String, classNameInLibrary:String):Sprite
Get a sprite from a swf library.
AssetManager
  
getStyleSheet(libraryName:String):StyleSheet
Get a StyleSheet object that was preloaded from a css file.
AssetManager
  
getSWF(libraryName:String):Loader
Get a SWF asset from the library.
AssetManager
  
getXML(libraryName:String):XML
Get an XML asset.
AssetManager
  
[static] Singleton Instance.
AssetManager
  
isAvailable(libraryName:String):Boolean
Check to see if an asset is available in the library.
AssetManager
  
removeAsset(libraryName:String):void
Remove an asset from the library.
AssetManager
Property detail
lastLibraryNameproperty
lastLibraryName:String  [read-only]

The last libraryName that was used to register an object. This is useful for when you don't neccessarily have a libraryName available, but you know that the librayName you need was the last asset registered in the AssetManager.

Implementation
    public function get lastLibraryName():String

Example
Using the lastLibraryName property.
 
   var am:AssetManager = AssetManager.gi();
   addChild(am.getBitmap(am.lastLibraryName)); //assuming you know the last asset was a bitmap
   

Method detail
addAsset()method
public function addAsset(libraryName:String, obj:String, source:* = null):void

Register an asset in the library.

Parameters
libraryName:String — The item id.
 
obj:String — The loaded asset object.
 
source:* (default = 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
*
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
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
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
getFLV()method 
public function getFLV(libraryName:String):FLV

Get an flv instance.

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

Returns
FLV
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
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
getNetStream()method 
public function getNetStream(libraryName:String):NetStream

Get a net stream that was used to load an flv.

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

Returns
NetStream
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
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
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
getStyleSheet()method 
public function getStyleSheet(libraryName:String):StyleSheet

Get a StyleSheet object that was preloaded from a css file.

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

Returns
StyleSheet
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
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
gi()method 
public static function gi():AssetManager

Singleton Instance.

Returns
AssetManager
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
removeAsset()method 
public function removeAsset(libraryName:String):void

Remove an asset from the library.

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