package starling.assets {
import starling.textures.TextureOptions;
import starling.textures.TextureAtlas;
import starling.textures.Texture;
import starling.text.BitmapFont;
import starling.events.EventDispatcher;
import openfl.utils.ByteArray;
import openfl.media.SoundTransform;
import openfl.media.SoundChannel;
import openfl.media.Sound;
import openfl.Vector;
[Event(name="texturesRestored",type="starling.events.Event")]
/**
 *  Dispatched when all textures have been restored after a context loss. 
 * @externs
 */
public class AssetManager extends starling.events.EventDispatcher {
	/**
	 *  Create a new instance with the given scale factor. 
	 */
	public function AssetManager(scaleFactor:Number = undefined) {
		super();
	}
	/**
	 *  Disposes all assets and purges the queue.
	 *      *
	 *      *  <p>Beware that all references to the assets will remain intact, even though the assets
	 *      *  are no longer valid. Call 'purge' if you want to remove all resources and reuse
	 *      *  the AssetManager later.</p>
	 *      
	 */
	public function dispose():void {}
	/**
	 *  Removes assets of all types (disposing them along the way), empties the queue and
	 *      *  aborts any pending load operations. 
	 */
	public function purge():void {}
	/**
	 *  Enqueues one or more raw assets; they will only be available after successfully
	 *      *  executing the "loadQueue" method. This method accepts a variety of different objects:
	 *      *
	 *      *  <ul>
	 *      *    <li>Strings or URLRequests containing an URL to a local or remote resource. Supported
	 *      *        types: <code>png, jpg, gif, atf, mp3, xml, fnt, json, binary</code>.</li>
	 *      *    <li>Instances of the File class (AIR only) pointing to a directory or a file.
	 *      *        Directories will be scanned recursively for all supported types.</li>
	 *      *    <li>Classes that contain <code>static</code> embedded assets.</li>
	 *      *    <li>If the file extension is not recognized, the data is analyzed to see if
	 *      *        contains XML or JSON data. If it's neither, it is stored as ByteArray.</li>
	 *      *  </ul>
	 *      *
	 *      *  <p>Suitable object names are extracted automatically: A file named "image.png" will be
	 *      *  accessible under the name "image". When enqueuing embedded assets via a class,
	 *      *  the variable name of the embedded object will be used as its name. An exception
	 *      *  are texture atlases: they will have the same name as the actual texture they are
	 *      *  referencing.</p>
	 *      *
	 *      *  <p>XMLs are made available via "getXml()"; this includes XMLs containing texture
	 *      *  atlases or bitmap fonts, which are processed along the way. Bitmap fonts are also
	 *      *  registered at the TextField class.</p>
	 *      *
	 *      *  <p>If you pass in JSON data, it will be parsed into an object and will be available via
	 *      *  "getObject()".</p>
	 *      
	 */
	public function enqueue(assets:Array):void {}
	/**
	 *  Enqueues a single asset with a custom name that can be used to access it later.
	 *      *  If the asset is a texture, you can also add custom texture options.
	 *      *
	 *      *  @param asset    The asset that will be enqueued; accepts the same objects as the
	 *      *                  'enqueue' method.
	 *      *  @param name     The name under which the asset will be found later. If you pass null or
	 *      *                  omit the parameter, it's attempted to generate a name automatically.
	 *      *  @param options  Custom options that will be used if 'asset' points to texture data.
	 *      *  @return         the name with which the asset was registered.
	 *      
	 */
	public function enqueueSingle(asset:*, name:String = undefined, options:starling.textures.TextureOptions = undefined, customExtension:String = undefined, customMimeType:String = undefined):String { return null; }
	/**
	 *  Removes the asset(s) with the given name(s) from the queue. Note that this won't work
	 * 	 *  after loading has started, even if these specific assets have not yet been processed. 
	 */
	public function dequeue(assetNames:Array):void {}
	/**
	 *  Empties the queue and aborts any pending load operations. 
	 */
	public function purgeQueue():void {}
	/**
	 *  Loads all enqueued assets asynchronously. The 'onComplete' callback will be executed
	 *      *  once all assets have been loaded - even when there have been errors, which are
	 *      *  forwarded to the optional 'onError' callback. The 'onProgress' function will be called
	 *      *  with a 'ratio' between '0.0' and '1.0' and is also optional. Furthermore, all
	 *      *  parameters of all the callbacks are optional.
	 *      *
	 *      *  <p>When you call this method, the manager will save a reference to "Starling.current";
	 *      *  all textures that are loaded will be accessible only from within this instance. Thus,
	 *      *  if you are working with more than one Starling instance, be sure to call
	 *      *  "makeCurrent()" on the appropriate instance before processing the queue.</p>
	 *      *
	 *      *  @param onComplete   <code>function(manager:AssetManager):void;</code>
	 *      *  @param onError      <code>function(error:String, asset:AssetReference):void;</code>
	 *      *  @param onProgress   <code>function(ratio:Number):void;</code>
	 *      
	 */
	public function loadQueue(onComplete:Function, onError:Function = undefined, onProgress:Function = undefined):void {}
	/**
	 *  Add an asset with a certain name and type.
	 *      *
	 *      *  <p>Beware: if the slot (name + type) was already taken, the existing object will be
	 *      *  disposed and replaced by the new one.</p>
	 *      *
	 *      *  @param name    The name with which the asset can be retrieved later. Must be
	 *      *                 unique within this asset type.
	 *      *  @param asset   The actual asset to add (e.g. a texture, a sound, etc).
	 *      *  @param type    The type of the asset. If omitted, the type will be determined
	 *      *                 automatically (which works for all standard types defined within
	 *      *                 the 'AssetType' class).
	 *      
	 */
	public function addAsset(name:String, asset:*, type:String = undefined):void {}
	/**
	 *  Retrieves an asset of the given type, with the given name. If 'recursive' is true,
	 *      *  the method will traverse included texture atlases and asset managers.
	 *      *
	 *      *  <p>Typically, you will use one of the type-safe convenience methods instead, like
	 *      *  'getTexture', 'getSound', etc.</p>
	 *      
	 */
	public function getAsset(type:String, name:String, recursive:Boolean = undefined):* { return null; }
	/**
	 *  Retrieves an alphabetically sorted list of all assets that have the given type and
	 *      *  start with the given prefix. If 'recursive' is true, the method will traverse included
	 *      *  texture atlases and asset managers. 
	 */
	public function getAssetNames(assetType:String, prefix:String = undefined, recursive:Boolean = undefined, out:openfl.Vector = undefined):openfl.Vector { return null; }
	/**
	 *  Removes the asset with the given name and type, and will optionally dispose it. 
	 */
	public function removeAsset(assetType:String, name:String, dispose:Boolean = undefined):void {}
	/**
	 *  Returns a texture with a certain name. Includes textures stored inside atlases. 
	 */
	public function getTexture(name:String):starling.textures.Texture { return null; }
	/**
	 *  Returns all textures that start with a certain string, sorted alphabetically
	 *      *  (especially useful for "MovieClip"). Includes textures stored inside atlases. 
	 */
	public function getTextures(prefix:String = undefined, out:openfl.Vector = undefined):openfl.Vector { return null; }
	/**
	 *  Returns all texture names that start with a certain string, sorted alphabetically.
	 *      *  Includes textures stored inside atlases. 
	 */
	public function getTextureNames(prefix:String = undefined, out:openfl.Vector = undefined):openfl.Vector { return null; }
	/**
	 *  Returns a texture atlas with a certain name, or null if it's not found. 
	 */
	public function getTextureAtlas(name:String):starling.textures.TextureAtlas { return null; }
	/**
	 *  Returns all texture atlas names that start with a certain string, sorted alphabetically.
	 *      *  If you pass an <code>out</code>-vector, the names will be added to that vector. 
	 */
	public function getTextureAtlasNames(prefix:String = undefined, out:openfl.Vector = undefined):openfl.Vector { return null; }
	/**
	 *  Returns a sound with a certain name, or null if it's not found. 
	 */
	public function getSound(name:String):openfl.media.Sound { return null; }
	/**
	 *  Returns all sound names that start with a certain string, sorted alphabetically.
	 *      *  If you pass an <code>out</code>-vector, the names will be added to that vector. 
	 */
	public function getSoundNames(prefix:String = undefined, out:openfl.Vector = undefined):openfl.Vector { return null; }
	/**
	 *  Generates a new SoundChannel object to play back the sound. This method returns a
	 *      *  SoundChannel object, which you can access to stop the sound and to control volume. 
	 */
	public function playSound(name:String, startTime:Number = undefined, loops:int = undefined, transform:openfl.media.SoundTransform = undefined):openfl.media.SoundChannel { return null; }
	/**
	 *  Returns an XML with a certain name, or null if it's not found. 
	 */
	public function getXml(name:String):* { return null; }
	/**
	 *  Returns all XML names that start with a certain string, sorted alphabetically.
	 *      *  If you pass an <code>out</code>-vector, the names will be added to that vector. 
	 */
	public function getXmlNames(prefix:String = undefined, out:openfl.Vector = undefined):openfl.Vector { return null; }
	/**
	 *  Returns an object with a certain name, or null if it's not found. Enqueued JSON
	 *      *  data is parsed and can be accessed with this method. 
	 */
	public function getObject(name:String):* { return null; }
	/**
	 *  Returns all object names that start with a certain string, sorted alphabetically.
	 *      *  If you pass an <code>out</code>-vector, the names will be added to that vector. 
	 */
	public function getObjectNames(prefix:String = undefined, out:openfl.Vector = undefined):openfl.Vector { return null; }
	/**
	 *  Returns a byte array with a certain name, or null if it's not found. 
	 */
	public function getByteArray(name:String):openfl.utils.ByteArray { return null; }
	/**
	 *  Returns all byte array names that start with a certain string, sorted alphabetically.
	 *      *  If you pass an <code>out</code>-vector, the names will be added to that vector. 
	 */
	public function getByteArrayNames(prefix:String = undefined, out:openfl.Vector = undefined):openfl.Vector { return null; }
	/**
	 *  Returns a bitmap font with a certain name, or null if it's not found. 
	 */
	public function getBitmapFont(name:String):starling.text.BitmapFont { return null; }
	/**
	 *  Returns all bitmap font names that start with a certain string, sorted alphabetically.
	 *      *  If you pass an <code>out</code>-vector, the names will be added to that vector. 
	 */
	public function getBitmapFontNames(prefix:String = undefined, out:openfl.Vector = undefined):openfl.Vector { return null; }
	/**
	 *  Returns an asset manager with a certain name, or null if it's not found. 
	 */
	public function getAssetManager(name:String):starling.assets.AssetManager { return null; }
	/**
	 *  Returns all asset manager names that start with a certain string, sorted alphabetically.
	 *      *  If you pass an <code>out</code>-vector, the names will be added to that vector. 
	 */
	public function getAssetManagerNames(prefix:String = undefined, out:openfl.Vector = undefined):openfl.Vector { return null; }
	/**
	 *  Removes a certain texture, optionally disposing it. 
	 */
	public function removeTexture(name:String, dispose:Boolean = undefined):void {}
	/**
	 *  Removes a certain texture atlas, optionally disposing it. 
	 */
	public function removeTextureAtlas(name:String, dispose:Boolean = undefined):void {}
	/**
	 *  Removes a certain sound. 
	 */
	public function removeSound(name:String):void {}
	/**
	 *  Removes a certain Xml object, optionally disposing it. 
	 */
	public function removeXml(name:String, dispose:Boolean = undefined):void {}
	/**
	 *  Removes a certain object. 
	 */
	public function removeObject(name:String):void {}
	/**
	 *  Removes a certain byte array, optionally disposing its memory right away. 
	 */
	public function removeByteArray(name:String, dispose:Boolean = undefined):void {}
	/**
	 *  Removes a certain bitmap font, optionally disposing it. 
	 */
	public function removeBitmapFont(name:String, dispose:Boolean = undefined):void {}
	/**
	 *  Removes a certain asset manager and optionally disposes it right away. 
	 */
	public function removeAssetManager(name:String, dispose:Boolean = undefined):void {}
	/**
	 *  Registers a custom AssetFactory. If you use any priority > 0, the factory will
	 *      *  be called before the default factories. The final factory to be invoked is the
	 *      *  'ByteArrayFactory', which is using a priority of '-100'. 
	 */
	public function registerFactory(factory:starling.assets.AssetFactory, priority:int = undefined):void {}
	/**
	 *  Unregisters the specified AssetFactory. 
	 */
	public function unregisterFactory(factory:starling.assets.AssetFactory):void {}
	/**
	 *  When activated, the class will trace information about added/enqueued assets.
	 *      *  @default true 
	 */
	public function get verbose():Boolean { return false; }
	public function set verbose(value:Boolean):void {}
	/**
	 *  Returns the number of raw assets that have been enqueued, but not yet loaded. 
	 */
	public function get numQueuedAssets():int { return 0; }
	/**
	 *  The maximum number of parallel connections that are spawned when loading the queue.
	 *      *  More connections can reduce loading times, but require more memory. @default 3. 
	 */
	public function get numConnections():int { return 0; }
	public function set numConnections(value:int):void {}
	/**
	 *  Textures will be created with the options set up in this object at the time of
	 *      *  enqueuing. 
	 */
	public function get textureOptions():starling.textures.TextureOptions { return null; }
	public function set textureOptions(value:starling.textures.TextureOptions):void {}
	/**
	 *  The DataLoader is used to load any data from files or URLs. If you need to customize
	 *      *  its behavior (e.g. to add a caching mechanism), assign your custom instance here. 
	 */
	public function get dataLoader():starling.assets.DataLoader { return null; }
	public function set dataLoader(value:starling.assets.DataLoader):void {}
	/**
	 *  Indicates if bitmap fonts should be registered with their "face" attribute from the
	 *      *  font XML file. Per default, they are registered with the name of the texture file.
	 *      *  @default false 
	 */
	public function get registerBitmapFontsWithFontFace():Boolean { return false; }
	public function set registerBitmapFontsWithFontFace(value:Boolean):void {}
}
}
