| Package | starlingbuilder.engine |
| Interface | public interface IAssetMediator |
You should implement your AssetMediator in your project. It can be a simple wrapper of starling.utils.AssetManager.
The following example is a simple implementation of IAssetMediator
public class AssetMediator
{
private var _assetManager:AssetManager;
public function AssetMediator(assetManager:AssetManager)
{
_assetManager = assetManager;
}
public function getTexture(name:String):Texture
{
return _assetManager.getTexture(name);
}
public function getTextures(prefix:String="", result:Vector.<Texture>=null):Vector.<Texture>
{
return _assetManager.getTextures(prefix, result);
}
public function getExternalData(name:String):Object
{
return null;
}
}See also
| Method | Defined By | ||
|---|---|---|---|
getExternalData(name:String):Object
Get external data by name. | IAssetMediator | ||
getTexture(name:String):Texture
Get texture by name. | IAssetMediator | ||
getTextures(prefix:String, result:Vector.<Texture> = null):Vector.<Texture>
Get textures by prefix. | IAssetMediator | ||
| getExternalData | () | method |
public function getExternalData(name:String):ObjectGet external data by name. Only used by loading external data (a layout referencing other layouts)
Parameters
name:String — of the layout
|
Object — external data with matched name
|
| getTexture | () | method |
public function getTexture(name:String):TextureGet texture by name. This method has the same signature of starling.utils.AssetManager.getTexture
Parameters
name:String — name of the texture
|
Texture — texture with matched name
|
| getTextures | () | method |
public function getTextures(prefix:String, result:Vector.<Texture> = null):Vector.<Texture>Get textures by prefix. This method has the same signature of starling.utils.AssetManager.getTextures Only used by MovieClip.
Parameters
prefix:String — prefix of the textures
| |
result:Vector.<Texture> (default = null) — vector of the matched textures to return
|
Vector.<Texture> — vector of the matched textures
|