Packageorg.vanrijkom.far
Classpublic class FarStream
InheritanceFarStream Inheritance flash.net.URLStream

The FarStream class loads and parses FAR formatted archives created with the FAR archive utility. Far extends flash.net.URLStream, and as such all of URLStream's public properties, methods and events are supported by FarStream.

The progress of an archive being streamed in can be monitored at two levels: at archive level, by using URLStream's native events, or at item level.

Monitoring at item level can be done by obtaining FarItem instances using the item() method, specifying an index expected to be in the archive. By adding FarEvent.ITEM_XXX listeners to the obtained FarItem instance, events will be triggered when more information becomes available on the item as a result of the archive progressively streaming in.

Alternatively, FarEvent.XXX listeners can be added to the FarStream instance itself. This way, event are received for all item events as they are triggered over time when the archive is progressively loaded in.

See also

item()
FarEvent


Public Properties
 PropertyDefined By
  count : uint
[read-only] Number of files stored in the in-memory archive file table.
FarStream
  indices : Array
[read-only] Retreive the list of indices as currently stored in the in-memory file table.
FarStream
  loaded : Boolean
[read-only] True if the archive has been fully loaded into memory.
FarStream
  loadedHeader : Boolean
[read-only] True if the archive's header has been fully loaded.
FarStream
  loadedTable : Boolean
[read-only] True if the archive's file table has been fully loaded.
FarStream
  version : Point
[read-only] Retreive loaded archive version.
FarStream
Public Methods
 MethodDefined By
  
Contruct a new FarLoader instance.
FarStream
  
close():void
[override] URLStream: Immediately closes the stream and cancels the download operation.
FarStream
  
exists(index:String):Boolean
True if the specified index is on the in-memory file table.
FarStream
  
item(index:String):FarItem
Retreive a FarItem object for the specified index name.
FarStream
  
itemAt(index:uint):FarItem
Retreive FarItem by queue position.
FarStream
  
load(request:URLRequest):void
[override] URLStream: Begins downloading the URL specified in the request parameter.
FarStream
  
loadFromURL(url:String):URLRequest
Begins downloading the arhive from the URL specified.
FarStream
Events
 Event Summary Defined By
  EventDispatcher Dispatched when Flash Player gains operating system focus and becomes active.FarStream
  URLStream: Dispatched when data has loaded successfully.FarStream
  EventDispatcher: Dispatched when Flash Player loses operating system focus and is becoming inactive.FarStream
  Dispatched when the loader has fully finished loading and possibly uncompressing an item from the archive.FarStream
  Dispatched when the loader is reading file data for an item in the arhive.FarStream
  Dispatched when the loader is about the uncompress an item in the archive.FarStream
  Dispatched when the loader has finished uncompressing an item in the archive.FarStream
  Dispatched when the loader is done loading and parsing the FAR file table.FarStream
  URLStream: Dispatched if a call to URLStream.load() attempts to access data over HTTP, and the current Flash Player is able to detect and return the status code for the request.FarStream
  URLStream: Dispatched when an input/output error occurs that causes a load operation to fail.FarStream
  URLStream: Dispatched when a load operation starts.FarStream
  URLStream: Dispatched when data is received as the download operation progresses.FarStream
  URLStream: Dispatched if a call to URLStream.load() attempts to load data from a server outside the security sandbox.FarStream
Public Constants
 ConstantDefined By
  VMAJOR : int = 0
[static] Highest FAR archive version this version of the API is capable of reading (major).
FarStream
  VMINOR : int = 1
[static] Highest FAR archive version this version of the API is capable of reading (minor).
FarStream
Property Detail
countproperty
count:uint  [read-only]

Number of files stored in the in-memory archive file table.

Until the archive file-table has been fully loaded, the returned value only reflects the number of items that have been added to the in-memory file-table using the #item() method.


Implementation
    public function get count():uint

See also

indicesproperty 
indices:Array  [read-only]

Retreive the list of indices as currently stored in the in-memory file table.


Implementation
    public function get indices():Array

See also

loadedproperty 
loaded:Boolean  [read-only]

True if the archive has been fully loaded into memory.


Implementation
    public function get loaded():Boolean

See also

loadedHeaderproperty 
loadedHeader:Boolean  [read-only]

True if the archive's header has been fully loaded.


Implementation
    public function get loadedHeader():Boolean

See also

loadedTableproperty 
loadedTable:Boolean  [read-only]

True if the archive's file table has been fully loaded.


Implementation
    public function get loadedTable():Boolean

See also

versionproperty 
version:Point  [read-only]

Retreive loaded archive version. The returned Point's x member reflects major version,y member minor version. Will return a Point(0,0) if the archive's header has not been loaded yet.


Implementation
    public function get version():Point
Constructor Detail
FarStream()Constructor
public function FarStream()

Contruct a new FarLoader instance. FarStream extends flash.net.URLStream.

See also

flash.net.URLStream
Method Detail
close()method
override public function close():void

URLStream: Immediately closes the stream and cancels the download operation. No data can be read from the stream after the close() method is called.

See also

flash.net.URLStream.load
exists()method 
public function exists(index:String):Boolean

True if the specified index is on the in-memory file table.

When invoked before having received the FarEvent.TABLE_COMPLETE event the method will only return true for indices that have been added using the item method.

Parameters

index:String

Returns
Boolean

See also

item()method 
public function item(index:String):FarItem

Retreive a FarItem object for the specified index name.

If the item is found in the in-memory file table, its associated FarItem is returned.

If the item is not found because the archive file-table has not been fully streamed in yet a new FarItem instance is created and added to the in-memory file table. If the item index was not found in the archive file-table after it has completed loading, the item will dispatch a IOErrorEvent.IO_ERROR event.

If the item is not found and the archive file-table has been fully loaded the method will throw an exception.

Parameters

index:String

Returns
FarItem

See also

FarItem
loadedTable
flash.events.IOErrorEvent.IO_ERROR
itemAt()method 
public function itemAt(index:uint):FarItem

Retreive FarItem by queue position. The index is zero based.

Until the archive file-table has been fully loaded, only items that have been added using the item method can be retreived.

Parameters

index:uint

Returns
FarItem

See also

load()method 
override public function load(request:URLRequest):void

URLStream: Begins downloading the URL specified in the request parameter.

Parameters

request:URLRequest

See also

flash.net.URLStream.load
loadFromURL()method 
public function loadFromURL(url:String):URLRequest

Begins downloading the arhive from the URL specified. Uses the load method internally, after creating an URLRequest instance from the URL string. The created URLRequest is passed as the return value.

Parameters

url:String

Returns
URLRequest

See also

flash.net.URLStream.load
Event Detail
activate Event
Event Object Type: flash.events.Event
Event.type property = flash.events.Event.ACTIVATE

EventDispatcher Dispatched when Flash Player gains operating system focus and becomes active.

complete Event  
Event Object Type: flash.events.Event
Event.type property = flash.events.Event.COMPLETE

URLStream: Dispatched when data has loaded successfully.

deactivate Event  
Event Object Type: flash.events.Event
Event.type property = flash.events.Event.DEACTIVATE

EventDispatcher: Dispatched when Flash Player loses operating system focus and is becoming inactive.

farItemComplete Event  
Event Object Type: org.vanrijkom.far.FarEvent
FarEvent.type property = org.vanrijkom.far.FarEvent.ITEM_COMPLETE

Dispatched when the loader has fully finished loading and possibly uncompressing an item from the archive.

Defines the value of the type property of a FarEvent object.
farItemProgress Event  
Event Object Type: org.vanrijkom.far.FarEvent
FarEvent.type property = org.vanrijkom.far.FarEvent.ITEM_PROGRESS

Dispatched when the loader is reading file data for an item in the arhive.

Defines the value of the type property of a FarEvent object.
farItemUncompress Event  
Event Object Type: org.vanrijkom.far.FarEvent
FarEvent.type property = org.vanrijkom.far.FarEvent.ITEM_UNCOMPRESS

Dispatched when the loader is about the uncompress an item in the archive.

Defines the value of the type property of a FarEvent object.
farItemUncompressed Event  
Event Object Type: org.vanrijkom.far.FarEvent
FarEvent.type property = org.vanrijkom.far.FarEvent.ITEM_UNCOMPRESSED

Dispatched when the loader has finished uncompressing an item in the archive.

Defines the value of the type property of a FarEvent object.
farTableComplete Event  
Event Object Type: org.vanrijkom.far.FarEvent
FarEvent.type property = org.vanrijkom.far.FarEvent.TABLE_COMPLETE

Dispatched when the loader is done loading and parsing the FAR file table.

Defines the value of the type property of a FarEvent object.
httpStatus Event  
Event Object Type: flash.events.HTTPStatusEvent
HTTPStatusEvent.type property = flash.events.HTTPStatusEvent.HTTP_STATUS

URLStream: Dispatched if a call to URLStream.load() attempts to access data over HTTP, and the current Flash Player is able to detect and return the status code for the request.

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

URLStream: Dispatched when an input/output error occurs that causes a load operation to fail.

open Event  
Event Object Type: flash.events.Event
Event.type property = flash.events.Event.OPEN

URLStream: Dispatched when a load operation starts.

progress Event  
Event Object Type: flash.events.ProgressEvent
ProgressEvent.type property = flash.events.ProgressEvent.PROGRESS

URLStream: Dispatched when data is received as the download operation progresses. Data that has been received can be read immediately using the methods of the URLStream class.

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

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

Constant Detail
VMAJORConstant
public static const VMAJOR:int = 0

Highest FAR archive version this version of the API is capable of reading (major).

VMINORConstant 
public static const VMINOR:int = 1

Highest FAR archive version this version of the API is capable of reading (minor).