Packagech.capi.net
Classpublic class LoadableFileFactory
InheritanceLoadableFileFactory Inheritance Object

Factory of ILoadableFile objects.

View the examples

See also

ILoadableFile
FileTypeSelector
LoadableFileType
IMassLoader


Public Properties
 PropertyDefined By
  alwaysUseCache : Boolean
Defines if all the ILoadableFile instances will use the cache or not.
LoadableFileFactory
  applicationDomainPolicy : String = null
Defines the ApplicationDomain policy.
LoadableFileFactory
  basePath : String = null
Defines the base path that will be used as prefix when a URLRequest is created.
LoadableFileFactory
  contextPolicy : IContextPolicy
Defines the IContextPolicy that will be used to create the LoaderContext and SoundLoaderContext objects.
LoadableFileFactory
  defaultLoadableFileFactory : LoadableFileFactory
[static] [read-only] Defines the default LoadableFileFactory.
LoadableFileFactory
  defaultVariables : IMap
Defines the default variables that will be used by the created ILoadableFile instances as parent IMap.
LoadableFileFactory
  defaultVirtualBytesTotal : uint
Defines the default virtual bytes to set to the created ILoadableFile objects.
LoadableFileFactory
  fileTypeSelector : FileTypeSelector
Defines the FileTypeSelector that will be used when the createFile method is called.
LoadableFileFactory
  listenersPriority : int
Defines the listeners priority when the attachListeners method is used.
LoadableFileFactory
  securityDomainPolicy : String = null
Defines the SecurityDomain policy.
LoadableFileFactory
Public Methods
 MethodDefined By
  
LoadableFileFactory(alwaysUseCache:Boolean = false, 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
  
Creates a clone of the current LoadableFileFactory.
LoadableFileFactory
  
create(url:Object, type:String = null, onOpen:Function = null, onProgress:Function = null, onComplete:Function = null, onClose:Function = null, onIOError:Function = null, onSecurityError:Function = null):ILoadableFile
[static] Creates a ILoadableFile object.
LoadableFileFactory
  
createFile(url:Object, type:String = null, 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
  
createLoaderFile(request:URLRequest = null, context:LoaderContext = null):LoaderFile
Create a ILoadableFile associated to a Loader object.
LoadableFileFactory
  
createSoundFile(request:URLRequest = null, context:SoundLoaderContext = null):SoundFile
Creates a ILoadableFile associated to a Sound object.
LoadableFileFactory
  
createURLLoaderFile(request:URLRequest = null, dataFormat:String = null):URLLoaderFile
Creates a ILoadableFile associated to a URLLoader object.
LoadableFileFactory
  
createURLStreamFile(request:URLRequest = null):URLStreamFile
Creates a ILoadableFile associated to a URLStream object.
LoadableFileFactory
  
getRequest(url:Object):URLRequest
[static] Creates a URLRequest from a url object.
LoadableFileFactory
Protected Methods
 MethodDefined By
  
getMethod(type:String):Function
Retrieves the method to call within the specified type to create a ILoadableFile.
LoadableFileFactory
  
Initialize the default data of the specified ILoadableFile.
LoadableFileFactory
Property Detail
alwaysUseCacheproperty
alwaysUseCache:Boolean  [read-write]

Defines if all the ILoadableFile instances will use the cache or not. If false, the the ILoadableFile.useCache property will be true only if there is a variable in its URL.


Implementation
    public function get alwaysUseCache():Boolean
    public function set alwaysUseCache(value:Boolean):void
applicationDomainPolicyproperty 
public var applicationDomainPolicy:String = null

Defines the ApplicationDomain policy. The value must be issued from the DomainUtils constants or null.

See also

basePathproperty 
public var basePath:String = null

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

See also

contextPolicyproperty 
contextPolicy:IContextPolicy  [read-write]

Defines the IContextPolicy that will be used to create the LoaderContext and SoundLoaderContext objects. This value is never null.


Implementation
    public function get contextPolicy():IContextPolicy
    public function set contextPolicy(value:IContextPolicy):void
defaultLoadableFileFactoryproperty 
defaultLoadableFileFactory:LoadableFileFactory  [read-only]

Defines the default LoadableFileFactory.


Implementation
    public static function get defaultLoadableFileFactory():LoadableFileFactory

See also

defaultVariablesproperty 
defaultVariables:IMap  [read-write]

Defines the default variables that will be used by the created ILoadableFile instances as parent IMap. The LoadableFileFactory will create a TreeMap for each ILoadableFile with this IMap as parent. This value is never null.


Implementation
    public function get defaultVariables():IMap
    public function set defaultVariables(value:IMap):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

fileTypeSelectorproperty 
fileTypeSelector:FileTypeSelector  [read-write]

Defines the FileTypeSelector that will be used when the createFile method is called. This value is never null. By default, this value is intialized by the default FileTypeSelector.


Implementation
    public function get fileTypeSelector():FileTypeSelector
    public function set fileTypeSelector(value:FileTypeSelector):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
securityDomainPolicyproperty 
public var securityDomainPolicy:String = null

Defines the SecurityDomain policy. The value must be issued from the DomainUtils constants or null.

See also

Constructor Detail
LoadableFileFactory()Constructor
public function LoadableFileFactory(alwaysUseCache:Boolean = false, defaultVirtualBytesTotal:uint = 204800, listenersPriority:int = 0)

Creates a new LoadableFileFactory object.

Parameters
alwaysUseCache:Boolean (default = false) — Indicates if the ILoadableFile.useCache property will be always true. Otherwise it will be true only if there is a variable in the URL.
 
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.
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

clone()method 
public function clone():LoadableFileFactory

Creates a clone of the current LoadableFileFactory. This method will only clone the current LoadableFileFactory and report its references in the new one.

Returns
LoadableFileFactory — The cloned LoadableFileFactory.
create()method 
public static function create(url:Object, type:String = null, onOpen:Function = null, onProgress:Function = null, onComplete:Function = null, onClose:Function = null, onIOError:Function = null, onSecurityError:Function = null):ILoadableFile

Creates a ILoadableFile object.

Parameters

url:Object — The url of the file.
 
type:String (default = null) — The file type issued from the LoadableFileType constants.
 
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 created ILoadableFile object.

See also

createFile()method 
public function createFile(url:Object, type:String = null, 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.

Parameters

url:Object — The url. If a basePath is set, then the url will be basePath + url.
 
type:String (default = null) — The file type issued from the LoadableFileType constants.
 
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

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

Create a ILoadableFile associated to a Loader object.

Parameters

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

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

Creates a ILoadableFile associated to a Sound object.

Parameters

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

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

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
URLLoaderFile — The ILoadableFile object created.
createURLStreamFile()method 
public function createURLStreamFile(request:URLRequest = null):URLStreamFile

Creates a ILoadableFile associated to a URLStream object.

Parameters

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

Returns
URLStreamFile — The ILoadableFile object created.
getMethod()method 
protected function getMethod(type:String):Function

Retrieves the method to call within the specified type to create a ILoadableFile. All functions returned by this method take a URLRequest as first argument.

Parameters

type:String — The type issued from the LoadableFileType constants.

Returns
Function — The method to call.

Throws
ArgumentError If — the type is invalid.
getRequest()method 
public static function getRequest(url:Object):URLRequest

Creates a URLRequest from a url object. If the url is a URLRequest, then it is simply returned. If the url is a String, it is encapsulated in a new URLRequest. Otherwise, an error is thrown.

Parameters

url:Object — The url object.

Returns
URLRequest — The created URLRequest object.

Throws
ArgumentError If — the url is not a URLRequest nor a String.
initializeFile()method 
protected function initializeFile(file:ILoadableFile):void

Initialize the default data of the specified ILoadableFile.

Parameters

file:ILoadableFile — The ILoadableFile to initialize.

Examples
     var file1:ILoadableFile = LoadableFileFactory.create("file.swf"); //use a Loader
     var file2:ILoadableFile = LoadableFileFactory.create("file.swf", LoadableFileType.BINARY); //use a URLLoader with URLLoaderDataFormat.BINARY 
     
     var myRequest:URLRequest = new URLRequest("file.txt");
     var file3:ILoadableFile = LoadableFileFactory.create(myRequest);