Packagech.capi.net
Classpublic class LoadableFileFactory

Factory of ILoadableFile objects.


Example
Basic usage of the LoableFileFactory :
  var factory:LoadableFileFactory = new LoadableFileFactory();
  var file:ILoadableFile = factory.create("myFile.swf"); //creates a Loader-based ILoadableFile
  
  //retrieves the load manager object
  var lo:Loader = file.loadManagerObject as Loader;
  

Advanced usage of the LoableFileFactory :
  var selector:ExtensionFileSelector = new ExtensionFileSelector();
  selector.extensions.put("swf", LoadableFileType.BINARY);
  
  var factory:LoadableFileFactory = new LoadableFileFactory(selector);
  var file:ILoadableFile = factory.create("myFile.swf"); //creates a binary URLLoader-based ILoadableFile
  
  //retrieves the load manager object
  var ulo:URLLoader = file.loadManagerObject as URLLoader;
  

See also

ILoadableFile
ILoadableFileSelector
LoadableFileType
IMassLoader


Public Properties
 PropertyDefined by
  basePath : String = "null"
Defines the base path that will be used as prefix when a URLRequest is created.
LoadableFileFactory
  defaultLoaderContext : LoaderContext
Defines the default LoaderContext that will be used to create a ILoadableFile based on a Loader object.
LoadableFileFactory
  defaultSoundLoaderContext : SoundLoaderContext
Defines the defaut SoundLoaderContext that will be used to create a ILoadableFile based on a Sound object.
LoadableFileFactory
  defaultUseCache : Boolean
Defines if the ILoadableFile created will use the cache or not.
LoadableFileFactory
  defaultVirtualBytesTotal : uint
Defines the default virtual bytes to set to the created ILoadableFile objects.
LoadableFileFactory
  listenersPriority : int
Defines the listeners priority when the attachListeners method is used.
LoadableFileFactory
  loadableFileSelector : ILoadableFileSelector
Defines the ILoadableFileSelector that will be used when the create or createFile method is called.
LoadableFileFactory
Public Methods
 MethodDefined by
  
LoadableFileFactory(fileSelector:ILoadableFileSelector = null, defaultUseCache:Boolean = true, defaultVirtualBytesTotal:uint = 204800, listenersPriority:int = 0)
Creates a new LoadableFileFactory object.
LoadableFileFactory
  
attachListeners(file:ILoadableFile, onOpen:Function = null, onProgress:Function = null, onComplete:Function = null, onClose:Function = null, onIOError:Function = null, onSecurityError:Function = null):void
Creates the listeners on a ILoadManager object.
LoadableFileFactory
  
create(url:String, onOpen:Function = null, onProgress:Function = null, onComplete:Function = null, onClose:Function = null, onIOError:Function = null, onSecurityError:Function = null):ILoadableFile
Creates a ILoadableFile directly from an url.
LoadableFileFactory
  
createFile(request:URLRequest, onOpen:Function = null, onProgress:Function = null, onComplete:Function = null, onClose:Function = null, onIOError:Function = null, onSecurityError:Function = null):ILoadableFile
Creates a ILoadableFile using the defined ILoadableFileSelector to determine which type of ILoadableFile to create.
LoadableFileFactory
  
createLoaderFile(request:URLRequest = null, context:LoaderContext = null):ILoadableFile
Create a ILoadableFile associated to a Loader object.
LoadableFileFactory
  
createSoundFile(request:URLRequest = null, context:SoundLoaderContext = null):ILoadableFile
Creates a ILoadableFile associated to a Sound object.
LoadableFileFactory
  
createURLLoaderFile(request:URLRequest = null, dataFormat:String = null):ILoadableFile
Creates a ILoadableFile associated to a URLLoader object.
LoadableFileFactory
  
createURLStreamFile(request:URLRequest = null):ILoadableFile
Creates a ILoadableFile associated to a URLStream object.
LoadableFileFactory
Protected Methods
 MethodDefined by
  
Initialize the default data of the specified ILoadableFile.
LoadableFileFactory
Property detail
basePathproperty
public var basePath:String = "null"

Defines the base path that will be used as prefix when a URLRequest is created.

See also

defaultLoaderContextproperty 
defaultLoaderContext:LoaderContext  [read-write]

Defines the default LoaderContext that will be used to create a ILoadableFile based on a Loader object.

Implementation
    public function get defaultLoaderContext():LoaderContext
    public function set defaultLoaderContext(value:LoaderContext):void

See also

defaultSoundLoaderContextproperty 
defaultSoundLoaderContext:SoundLoaderContext  [read-write]

Defines the defaut SoundLoaderContext that will be used to create a ILoadableFile based on a Sound object.

Implementation
    public function get defaultSoundLoaderContext():SoundLoaderContext
    public function set defaultSoundLoaderContext(value:SoundLoaderContext):void

See also

defaultUseCacheproperty 
defaultUseCache:Boolean  [read-write]

Defines if the ILoadableFile created will use the cache or not.

Implementation
    public function get defaultUseCache():Boolean
    public function set defaultUseCache(value:Boolean):void

See also

defaultVirtualBytesTotalproperty 
defaultVirtualBytesTotal:uint  [read-write]

Defines the default virtual bytes to set to the created ILoadableFile objects.

Implementation
    public function get defaultVirtualBytesTotal():uint
    public function set defaultVirtualBytesTotal(value:uint):void

See also

listenersPriorityproperty 
listenersPriority:int  [read-write]

Defines the listeners priority when the attachListeners method is used.

Implementation
    public function get listenersPriority():int
    public function set listenersPriority(value:int):void
loadableFileSelectorproperty 
loadableFileSelector:ILoadableFileSelector  [read-write]

Defines the ILoadableFileSelector that will be used when the create or createFile method is called.

Implementation
    public function get loadableFileSelector():ILoadableFileSelector
    public function set loadableFileSelector(value:ILoadableFileSelector):void

See also

Constructor detail
LoadableFileFactory()constructor
public function LoadableFileFactory(fileSelector:ILoadableFileSelector = null, defaultUseCache:Boolean = true, defaultVirtualBytesTotal:uint = 204800, listenersPriority:int = 0)

Creates a new LoadableFileFactory object.

Parameters
fileSelector:ILoadableFileSelector (default = null) — The ILoadableFileSelector. By default, a ExtensionFileSelector will be created.
 
defaultUseCache:Boolean (default = true) — Indicates if the ILoadableFile will use the cache or not.
 
defaultVirtualBytesTotal:uint (default = 204800) — The virtual bytes to set by default to the created ILoadableFile objects.
 
listenersPriority:int (default = 0) — Defines the listeners priority when the attachListeners method is used.

See also

Method detail
attachListeners()method
public function attachListeners(file:ILoadableFile, onOpen:Function = null, onProgress:Function = null, onComplete:Function = null, onClose:Function = null, onIOError:Function = null, onSecurityError:Function = null):void

Creates the listeners on a ILoadManager object.

Parameters
file:ILoadableFile — The ILoadManager to listen.
 
onOpen:Function (default = null) — The Event.OPEN listener.
 
onProgress:Function (default = null) — The ProgressEvent.PROGRESS listener.
 
onComplete:Function (default = null) — The Event.COMPLETE listener.
 
onClose:Function (default = null) — The Event.CLOSE listener.
 
onIOError:Function (default = null) — The IOErrorEvent.IO_ERROR listener.
 
onSecurityError:Function (default = null) — The SecurityErrorEvent.SECURITY_ERROR listener.

See also

create()method 
public function create(url:String, onOpen:Function = null, onProgress:Function = null, onComplete:Function = null, onClose:Function = null, onIOError:Function = null, onSecurityError:Function = null):ILoadableFile

Creates a ILoadableFile directly from an url. This method will simply create a URLRequest object and return the ILoadableFile retrieved by the createFile() method.

Parameters
url:String — The url. If a basePath is set, then the url will be basePath + url.
 
onOpen:Function (default = null) — The Event.OPEN listener.
 
onProgress:Function (default = null) — The ProgressEvent.PROGRESS listener.
 
onComplete:Function (default = null) — The Event.COMPLETE listener.
 
onClose:Function (default = null) — The Event.CLOSE listener.
 
onIOError:Function (default = null) — The IOErrorEvent.IO_ERROR listener.
 
onSecurityError:Function (default = null) — The SecurityErrorEvent.SECURITY_ERROR listener.

Returns
ILoadableFile — The ILoadableFile object created.

See also

createFile()method 
public function createFile(request:URLRequest, onOpen:Function = null, onProgress:Function = null, onComplete:Function = null, onClose:Function = null, onIOError:Function = null, onSecurityError:Function = null):ILoadableFile

Creates a ILoadableFile using the defined ILoadableFileSelector to determine which type of ILoadableFile to create.

Parameters
request:URLRequest — The url request.
 
onOpen:Function (default = null) — The Event.OPEN listener.
 
onProgress:Function (default = null) — The ProgressEvent.PROGRESS listener.
 
onComplete:Function (default = null) — The Event.COMPLETE listener.
 
onClose:Function (default = null) — The Event.CLOSE listener.
 
onIOError:Function (default = null) — The IOErrorEvent.IO_ERROR listener.
 
onSecurityError:Function (default = null) — The SecurityErrorEvent.SECURITY_ERROR listener.

Returns
ILoadableFile — The ILoadableFile object created or null if the ILoadableFile has not been created.

See also

createLoaderFile()method 
public function createLoaderFile(request:URLRequest = null, context:LoaderContext = null):ILoadableFile

Create a ILoadableFile associated to a Loader object.

Parameters
request:URLRequest (default = null) — The url request.
 
context:LoaderContext (default = null) — The LoaderContext.

Returns
ILoadableFile — The ILoadableFile object created.
createSoundFile()method 
public function createSoundFile(request:URLRequest = null, context:SoundLoaderContext = null):ILoadableFile

Creates a ILoadableFile associated to a Sound object.

Parameters
request:URLRequest (default = null) — The url request.
 
context:SoundLoaderContext (default = null) — The SoundLoaderContext.

Returns
ILoadableFile — The ILoadableFile object created.
createURLLoaderFile()method 
public function createURLLoaderFile(request:URLRequest = null, dataFormat:String = null):ILoadableFile

Creates a ILoadableFile associated to a URLLoader object.

Parameters
request:URLRequest (default = null) — The url request.
 
dataFormat:String (default = null) — The format of the data issued from the URLLoaderDataFormat constants.

Returns
ILoadableFile — The ILoadableFile object created.
createURLStreamFile()method 
public function createURLStreamFile(request:URLRequest = null):ILoadableFile

Creates a ILoadableFile associated to a URLStream object.

Parameters
request:URLRequest (default = null) — The url request.

Returns
ILoadableFile — The ILoadableFile object created.
initializeFile()method 
protected function initializeFile(file:ILoadableFile):void

Initialize the default data of the specified ILoadableFile.

Parameters
file:ILoadableFile — The ILoadableFile to initialize.