Packagecom.sibirjak.angara.resource
Classpublic class AbstractResourceLoader
InheritanceAbstractResourceLoader Inheritance AbstractLoaderItem Inheritance AbstractProgressInfo Inheritance flash.events.EventDispatcher
ImplementsIResourceLoader
SubclassesLoaderDelegate, URLLoaderDelegate

Abstract implementation of the IResourceLoader interface.



Public Properties
 PropertyDefined by
  bytesLoaded : uint
[read-only] Returns the number of bytes already loaded.
AbstractResourceLoader
  bytesTotal : uint
[read-only] Returns the number of bytes total.
AbstractResourceLoader
  callbackFunction : Function
[write-only]
AbstractResourceLoader
  content : *
[read-only] Returns a reference to the loaded content.
AbstractResourceLoader
  failedLoadingTrials : uint
[read-only] Returns the number of failed loading trails.
AbstractResourceLoader
  httpStatus : int
[read-only] Returns the http status of a loaded resource.
AbstractResourceLoader
 InheriteditemType : String
The type of the loader item.
AbstractLoaderItem
 Inheritedkey : String
Returns the identifying key of the loader item.
AbstractLoaderItem
  loadingError : LoadingError
[read-only] Returns the loading error in a ResourceLoaderEvent.FAILURE event.
AbstractResourceLoader
  maxLoadingTrials : uint
Returns the max number of trails in case of failures.
AbstractResourceLoader
 InheritednumItems : uint
Returns the number of items to be loaded within the loader item.
AbstractProgressInfo
 InheritednumItemsFailed : uint
Returns the number of items failed within the loader item.
AbstractProgressInfo
 InheritednumItemsLoaded : uint
Returns the number of items loaded within the loader item.
AbstractProgressInfo
 Inheritedprogress : Number
Returns the progress of the loader item as a decimal value between zero and 1.
AbstractProgressInfo
 Inheritedscheduled : Boolean
Returns true, if the item already has been added to the loader manager directly or to a sequence or a sequence manager.
AbstractLoaderItem
 Inheritedstatus : String
The current loading status.
AbstractLoaderItem
  timeout : uint
[write-only] Specifies a timeout after that the resource loader will fail.
AbstractResourceLoader
  url : String
[read-only] Returns the URL of the resource loader.
AbstractResourceLoader
Protected Properties
 PropertyDefined by
  _failedLoadingTrials : uint = 0
Number of failed loading trials.
AbstractResourceLoader
 Inherited_isScheduled : Boolean = false
The schedule marker.
AbstractLoaderItem
 Inherited_key : String
The key used for debugging purposes.
AbstractLoaderItem
  _loadingError : LoadingError
Loading error information.
AbstractResourceLoader
  _loadingTrials : uint = 0
Number of loading trials already done.
AbstractResourceLoader
 Inherited_numItems : uint = 0
The number of items added.
AbstractProgressInfo
 Inherited_numItemsFailed : uint = 0
The number of items failed loading.
AbstractProgressInfo
 Inherited_numItemsLoaded : uint = 0
The number of items alredy loaded.
AbstractProgressInfo
 Inherited_progress : Number = 0
The overall progress of the item.
AbstractProgressInfo
  _request : URLRequest
The request.
AbstractResourceLoader
 Inherited_status : String
The loader item status.
AbstractLoaderItem
 Inherited_type : String
The loader item type.
AbstractLoaderItem
Public Methods
 MethodDefined by
  
AbstractResourceLoader(request:URLRequest)
Constructor
AbstractResourceLoader
  
getProperty(name:String):*
Lets you pull a prior specified runtime property.
AbstractResourceLoader
  
load():void
Starts loading of the resource.
AbstractResourceLoader
  
pause():void
Marks the item to be ignored by subsequent loader manager queue pulling operations.
AbstractResourceLoader
  
resume():void
Marks a prior paused item to be eligible for loader manager queue polling operations.
AbstractResourceLoader
  
setProperty(name:String, value:*):void
Lets you specify an arbitrary runtime property to be available within each resource loader event.
AbstractResourceLoader
  
stop():void
Immediately stops loading of the item or its containing items.
AbstractResourceLoader
Protected Methods
 MethodDefined by
  
clear():Boolean
Template method to clean up all internal loader references.
AbstractResourceLoader
  
Dispatches the ResourceLoaderEvent.COMPLETE event.
AbstractResourceLoader
  
Dispatches the ResourceLoaderEvent.FAILURE event.
AbstractResourceLoader
  
dispatchInit():void
Dispatches the ResourceLoaderEvent.INIT event.
AbstractResourceLoader
  
Dispatches the ResourceLoaderEvent.LOADING event.
AbstractResourceLoader
  
Dispatches the ResourceLoaderEvent.TRIAL_FAILURE event.
AbstractResourceLoader
  
Dispatches the ResourceLoaderEvent.PAUSE event.
AbstractResourceLoader
  
Dispatches the ResourceLoaderEvent.PROGRESS event.
AbstractResourceLoader
  
Dispatches the ResourceLoaderEvent.RESUME event.
AbstractResourceLoader
  
dispatchStop():void
Dispatches the ResourceLoaderEvent.STOP event.
AbstractResourceLoader
  
notifyComplete(content:*):void
A subclass must call notifyComplete in all cases the loading of the resource has been finished successfully.
AbstractResourceLoader
  
notifyFailure(errorType:String, failureMessage:String, error:Error = null):void
A subclass must call notifyFailure in all cases the loading of the resource cannot be accomplished.
AbstractResourceLoader
  
notifyHttpStatus(status:int):void
A subclass may call notifyHttpStatus to store a http status code.
AbstractResourceLoader
  
notifyInit(content:*):void
A subclass may call notifyInit if the content is ready for display or any other use.
AbstractResourceLoader
  
notifyProgress(bytesTotal:uint = 0, bytesLoaded:uint = 0):void
A subclass may call notifyProgress to inform the clients about a change in progess.
AbstractResourceLoader
  
startLoading():void
Template method to set up all internal loader references and start loading.
AbstractResourceLoader
Property detail
bytesLoadedproperty
bytesLoaded:uint  [read-only]

Returns the number of bytes already loaded.

Implementation
    public function get bytesLoaded():uint
bytesTotalproperty 
bytesTotal:uint  [read-only]

Returns the number of bytes total.

Note this is only available after a net connection has been established and the resource information has been received and the http response contains a file size property. In all other cases this method will return zero unit the resource is completely loaded from the server. Implementation
    public function get bytesTotal():uint

callbackFunctionproperty 
callbackFunction:Function  [write-only]Implementation
    public function set callbackFunction(value:Function):void
contentproperty 
content:*  [read-only]

Returns a reference to the loaded content.

For streaming types the content will be available not before the INIT event has been dispatched. For static types the content won't be available until the resource has been loaded completely from the remote destination. Implementation
    public function get content():*

_failedLoadingTrialsproperty 
protected var _failedLoadingTrials:uint = 0

Number of failed loading trials.

failedLoadingTrialsproperty 
failedLoadingTrials:uint  [read-only]

Returns the number of failed loading trails.

Implementation
    public function get failedLoadingTrials():uint
httpStatusproperty 
httpStatus:int  [read-only]

Returns the http status of a loaded resource.

Initial value is -1.

Loading from a local realm will set the http status to 0.

Loading from a not permitted remote realm will set the http status to 0.

Implementation
    public function get httpStatus():int
_loadingErrorproperty 
protected var _loadingError:LoadingError

Loading error information.

loadingErrorproperty 
loadingError:LoadingError  [read-only]

Returns the loading error in a ResourceLoaderEvent.FAILURE event.

Implementation
    public function get loadingError():LoadingError
_loadingTrialsproperty 
protected var _loadingTrials:uint = 0

Number of loading trials already done.

maxLoadingTrialsproperty 
maxLoadingTrials:uint  [read-write]

Returns the max number of trails in case of failures.

Implementation
    public function get maxLoadingTrials():uint
    public function set maxLoadingTrials(value:uint):void
_requestproperty 
protected var _request:URLRequest

The request.

timeoutproperty 
timeout:uint  [write-only]

Specifies a timeout after that the resource loader will fail.

If the resource loader does not show any raise in progress within this timeout, the loader will try to restart loading the resource as often as specified in connectionTrials. If the number of connectionTrials has been reached, the loader will be marked as failed and dispatch a ResourceLoaderEvent.FAILURE.

Default value is 1000 ms = 1 second.

Implementation
    public function set timeout(value:uint):void
urlproperty 
url:String  [read-only]

Returns the URL of the resource loader.

Implementation
    public function get url():String
Constructor detail
AbstractResourceLoader()constructor
public function AbstractResourceLoader(request:URLRequest)

Constructor

Parameters
request:URLRequest — The request.
Method detail
callbackFinished()method
sibirjak_loader function callbackFinished():void

Framework internal method to notify the resource loader about the completion of the callback.

Will be invoked by the internal Callback instance.

clear()method 
protected function clear():Boolean

Template method to clean up all internal loader references.

An implementor should clean up here all listeners to its particular internal loader and call its clear method.

After a reset() invokation the loader must not dispatch any further loading event.

Returns
Boolean
dispatchComplete()method 
protected function dispatchComplete():void

Dispatches the ResourceLoaderEvent.COMPLETE event.

dispatchFailure()method 
protected function dispatchFailure():void

Dispatches the ResourceLoaderEvent.FAILURE event.

dispatchInit()method 
protected function dispatchInit():void

Dispatches the ResourceLoaderEvent.INIT event.

dispatchLoading()method 
protected function dispatchLoading():void

Dispatches the ResourceLoaderEvent.LOADING event.

dispatchLoadingTrialFailure()method 
protected function dispatchLoadingTrialFailure():void

Dispatches the ResourceLoaderEvent.TRIAL_FAILURE event.

dispatchPause()method 
protected function dispatchPause():void

Dispatches the ResourceLoaderEvent.PAUSE event.

dispatchProgress()method 
protected function dispatchProgress():void

Dispatches the ResourceLoaderEvent.PROGRESS event.

dispatchResume()method 
protected function dispatchResume():void

Dispatches the ResourceLoaderEvent.RESUME event.

dispatchStop()method 
protected function dispatchStop():void

Dispatches the ResourceLoaderEvent.STOP event.

getProperty()method 
public function getProperty(name:String):*

Lets you pull a prior specified runtime property.

Parameters
name:String — The name of the property.

Returns
* — The value of the property to get.
hasCallback()method 
sibirjak_loader function hasCallback():Boolean

Framework internal method to detect, if a callback has been defined to this resource loader.

Returns
Boolean — true, if a callback is defined.
load()method 
public function load():void

Starts loading of the resource.

Won't have any effect if the status is any other than LoaderItemStatus.WAITING.

notifyComplete()method 
protected function notifyComplete(content:*):void

A subclass must call notifyComplete in all cases the loading of the resource has been finished successfully.

Executes the callback before the final COMPLETE event is dispatched.

Parameters
content:* — The loaded content.
notifyFailure()method 
protected final function notifyFailure(errorType:String, failureMessage:String, error:Error = null):void

A subclass must call notifyFailure in all cases the loading of the resource cannot be accomplished.

Parameters
errorType:String — The detailed failure description.
 
failureMessage:String
 
error:Error (default = null)
notifyHttpStatus()method 
protected final function notifyHttpStatus(status:int):void

A subclass may call notifyHttpStatus to store a http status code.

Parameters
status:int — The status code.
notifyInit()method 
protected function notifyInit(content:*):void

A subclass may call notifyInit if the content is ready for display or any other use.

Parameters
content:* — The loaded content.
notifyProgress()method 
protected final function notifyProgress(bytesTotal:uint = 0, bytesLoaded:uint = 0):void

A subclass may call notifyProgress to inform the clients about a change in progess.

Parameters
bytesTotal:uint (default = 0) — The loaded content.
 
bytesLoaded:uint (default = 0)
pause()method 
public override function pause():void

Marks the item to be ignored by subsequent loader manager queue pulling operations.

Sets the items status to LoaderItemStatus.PAUSED. Does only have effect to items which status is LoaderItemStatus.WAITING. You cannot pause a loading or finished item. To interrupt loading you need to call stop() for the particular item.

If the item is of type LoaderItemType.SEQUENCE, only the sequence will be marked as paused.

If the item is of type LoaderItemType.SEQUENCE_MANAGER, only the sequence manager will be marked as paused.

resume()method 
public override function resume():void

Marks a prior paused item to be eligible for loader manager queue polling operations.

Sets the items status to LoaderItemStatus.WAITING. Does only have effect to items which status is LoaderItemStatus.PAUSED.

If the item is of type LoaderItemType.SEQUENCE, only the sequence's status will be affected.

If the item is of type LoaderItemType.SEQUENCE_MANAGER, only the sequence manager's status will be affected.

setProperty()method 
public function setProperty(name:String, value:*):void

Lets you specify an arbitrary runtime property to be available within each resource loader event.

Parameters
name:String — The name of the property.
 
value:* — The value of the property.
startLoading()method 
protected function startLoading():void

Template method to set up all internal loader references and start loading.

An implementor should set up here all listeners to its particular internal loader and invoke its load method.

stop()method 
public override function stop():void

Immediately stops loading of the item or its containing items.

If the item is of type LoaderItemType.LOADER and is currently being loading, the associated net connection will be closed. Does only have effect to resource loaders, which status is LoaderItemStatus.LOADING. Sets the loader status back to LoaderItemStatus.WAITING. You cannot stop finished loaders (LoaderItemStatus.COMPLETE, LoaderItemStatus.FAILURE) any more.

If the item is of type LoaderItemType.SEQUENCE, all open loaders assigned to the seqeunce will be stopped.

If the item is of type LoaderItemType.SEQUENCE_MANAGER, the stop method of all assigned sequences will be called.