Packagech.capi.net
Interfacepublic interface ILoadableFile extends ILoadManager , INetStateManager , IGlobalEventDispatcher , IEventDispatcher
Implementors LoaderFile, SoundFile, URLLoaderFile, URLStreamFile

Represents a loadable file.

See also

AbstractLoadableFile
LoadableFileFactory
LoadableFileType
FileTypeSelector


Public Properties
 PropertyDefined By
 InheritedbytesLoaded : uint
[read-only] Defines the bytes that have been loaded.
ILoadManager
 InheritedbytesTotal : uint
[read-only] Defines the total bytes to load.
ILoadManager
 InheritedcloseEvent : Event
[read-only] Defines the event that happend to close the file (Event.CLOSE, Event.COMPLETE, ...).
ILoadManager
  fixedRequest : URLRequest
[read-only] Defines the URLRequest that will be loaded by the ILoadableFile.
ILoadableFile
 Inheritedloaded : Boolean
[read-only] Defines if the ILoadManager operation is complete.
ILoadManager
  loadManagerObject : Object
[read-only] Defines the load manager object.
ILoadableFile
 InheritednetState : String
Defines the NetState value.
INetStateManager
  properties : IProperties
[read-only] Defines the properties stored in the ILoadableFile.
ILoadableFile
 InheritedstateIdle : Boolean
[read-only] Defines if the ILoadManager is idle.
ILoadManager
 InheritedstateLoading : Boolean
[read-only] Defines if the ILoadManager is loading.
ILoadManager
  urlRequest : URLRequest
Defines the URLRequest object that specify the URL to load.
ILoadableFile
  urlVariables : IMap
Defines the variables key/values to be replaced in the url before the loading is launched.
ILoadableFile
  useCache : Boolean
Defines if the ILoadableFile can use the cache or not.
ILoadableFile
  virtualBytesTotal : uint
Defines the virtual total bytes.
ILoadableFile
Public Methods
 MethodDefined By
  
destroy():void
Destroys this ILoadableFile.
ILoadableFile
  
getData(dataType:String = null, appDomain:ApplicationDomain = null):*
Retrieves the data of the loadManagerObject if the loading is complete.
ILoadableFile
  
getEventDispatcher():IEventDispatcher
Retrieves the IEventDispatcher of all the sub-events of a ILoadableFile.
ILoadableFile
  
getType():String
Retrieves the type of the file based on the LoadableFileType constants.
ILoadableFile
  
Invalidate the current fixedRequest.
ILoadableFile
  
isClassSupported(aClass:String, appDomain:ApplicationDomain = null):Boolean
Retrieves if the specified class type is supported by this ILoadableFile or not.
ILoadableFile
  
isDestroyed():Boolean
Retrieves if this ILoadableFile has been destroyed.
ILoadableFile
 Inherited
isOnline():Boolean
Retrieves the state depending of the NetState value defined.
INetStateManager
  
Tells the ILoadableFile to update the fixedRequest value that will be used to load the file.
ILoadableFile
 Inherited
start():Boolean
Starts downloading data from the specified URL.
ILoadManager
 Inherited
stop():void
Stops the load operation in progress.
ILoadManager
Events
 Event Summary Defined By
  Dispatched when the http headers are received.ILoadableFile
  Dispatched when the content of the loadManagerObject is displayed.ILoadableFile
  Dispatched if a call to start() results in a fatal error that terminates the download.ILoadableFile
  Dispatched if a call to start() attempts to load data from a server outside the security sandbox.ILoadableFile
  Dispatched when the load couldn't start.ILoadableFile
Property Detail
fixedRequestproperty
fixedRequest:URLRequest  [read-only]

Defines the URLRequest that will be loaded by the ILoadableFile. This URLRequest has no more variables. If for some reason you need to modify the fixed request before starting the loading you should call the prepareFixedRequest() before, otherwise all your changes will be lost.


Implementation
    public function get fixedRequest():URLRequest

See also

loadManagerObjectproperty 
loadManagerObject:Object  [read-only]

Defines the load manager object. This object represents the object that manages the loading, i.e. a Loader, URLLoader, Sound, ...


Implementation
    public function get loadManagerObject():Object
propertiesproperty 
properties:IProperties  [read-only]

Defines the properties stored in the ILoadableFile.


Implementation
    public function get properties():IProperties
urlRequestproperty 
urlRequest:URLRequest  [read-write]

Defines the URLRequest object that specify the URL to load.


Implementation
    public function get urlRequest():URLRequest
    public function set urlRequest(value:URLRequest):void
urlVariablesproperty 
urlVariables:IMap  [read-write]

Defines the variables key/values to be replaced in the url before the loading is launched.


Implementation
    public function get urlVariables():IMap
    public function set urlVariables(value:IMap):void

See also

useCacheproperty 
useCache:Boolean  [read-write]

Defines if the ILoadableFile can use the cache or not.


Implementation
    public function get useCache():Boolean
    public function set useCache(value:Boolean):void
virtualBytesTotalproperty 
virtualBytesTotal:uint  [read-write]

Defines the virtual total bytes. This value represents an approximation of the total bytes. This value should be greather than the real amount of bytes of the loadable file.


Implementation
    public function get virtualBytesTotal():uint
    public function set virtualBytesTotal(value:uint):void
Method Detail
destroy()method
public function destroy():void

Destroys this ILoadableFile. This method causes to set the loadManagerObject value to null and releases all other references to the content loaded contained in the current ILoadableFile. After calling this method, no more operation is available on the ILoadableFile instance.

getData()method 
public function getData(dataType:String = null, appDomain:ApplicationDomain = null):*

Retrieves the data of the loadManagerObject if the loading is complete. If the asClass parameter is specified, then the ILoadableFile will try to create an instance of it and parse the content in it.

Parameters

dataType:String (default = null) — The type that should be returned by the method (see DataType).
 
appDomain:ApplicationDomain (default = null) — The ApplicationDomain to retrieve the class. If null is specified, then the current domain will be used.

Returns
* — The data of the loadManagerObject.

Throws
ArgumentError If — the class type is not supported.
 
ch.capi.errors:DataError If — the data are not loaded.

See also

getEventDispatcher()method 
public function getEventDispatcher():IEventDispatcher

Retrieves the IEventDispatcher of all the sub-events of a ILoadableFile. For example, the source event dispatcher of a Loader object will be his contentLoaderInfo.

Returns
IEventDispatcher — The IEventDispatcher.
getType()method 
public function getType():String

Retrieves the type of the file based on the LoadableFileType constants.

Returns
String — The ILoadableFile type.

See also

invalidateFixedRequest()method 
public function invalidateFixedRequest():void

Invalidate the current fixedRequest. It means that the next time the start() method will be launched, the ILoadableFile will relaunch the loading of the data, without taking care of the cache.

See also

isClassSupported()method 
public function isClassSupported(aClass:String, appDomain:ApplicationDomain = null):Boolean

Retrieves if the specified class type is supported by this ILoadableFile or not.

Parameters

aClass:String — The class type to check.
 
appDomain:ApplicationDomain (default = null) — The ApplicationDomain to retrieve the class. If null is specified, then the current domain will be used.

Returns
Booleantrue if the type is supported.

See also

isDestroyed()method 
public function isDestroyed():Boolean

Retrieves if this ILoadableFile has been destroyed. If this method returns true, then no more operation is available on the ILoadableFile.

Returns
Booleantrue if the file has been destroyed.
prepareFixedRequest()method 
public function prepareFixedRequest():void

Tells the ILoadableFile to update the fixedRequest value that will be used to load the file.

See also

Event Detail
httpStatus Event
Event Object Type: flash.events.HTTPStatusEvent
HTTPStatusEvent.type property = flash.events.HTTPStatusEvent.HTTP_STATUS

Dispatched when the http headers are received. This event isn't sent by the all the load manager objects.

init Event  
Event Object Type: flash.events.Event
Event.type property = flash.events.Event.INIT

Dispatched when the content of the loadManagerObject is displayed. This event is only dispatched if the type of ILoadableFile is LoadableFileType.SWF or when the data of a binary URLLoaderFile is retrieved as DataType.LOADER.

ioError Event  
Event Object Type: flash.events.IOErrorEvent
IOErrorEvent.type property = flash.events.IOErrorEvent.IO_ERROR

Dispatched if a call to start() results in a fatal error that terminates the download.

securityError Event  
Event Object Type: flash.events.SecurityErrorEvent
SecurityErrorEvent.type property = flash.events.SecurityErrorEvent.SECURITY_ERROR

Dispatched if a call to start() attempts to load data from a server outside the security sandbox.

startFailed Event  
Event Object Type: ch.capi.events.LoadStartErrorEvent
LoadStartErrorEvent.type property = ch.capi.events.LoadStartErrorEvent.START_FAILED

Dispatched when the load couldn't start. That means that an error has occured during the start() method and an Error has been thrown.

Defines the 'startFailed' error event.