Packageorg.vanrijkom.far
Classpublic final class FarItem
InheritanceFarItem Inheritance flash.events.EventDispatcher

The FarItem class represent an entry in a FAR file's file table. FarItem instances can be obtained prior to the archive's file table having streamed in from file. As a result, an item can be bound to a non-existing index. Once an archives file table has been fully loaded, the validity of the item's index is checked. If the index is invalid, an IOErrorEvent is triggered.

See also

flash.events.IOErrorEvent
FarStream.item()


Public Properties
 PropertyDefined By
  bytesLoaded : Number
[read-only] Number of (possibly compressed) bytes read from the archive thus far.
FarItem
  bytesTotal : Number
[read-only] Total item file data size (possibly compressed) as stored in the archive.
FarItem
  compressed : Boolean
[read-only] True if the file data belonging to this item is compressed in the archive.
FarItem
  data : ByteArray
[read-only] Item file data, as loaded thus far from the archive.
FarItem
  index : String
[read-only] The string uniquely identifying this item in the FAR archive.
FarItem
  loaded : Boolean
[read-only] True if the file data belonfing to this item has fully loaded from the archive.
FarItem
Public Methods
 MethodDefined By
  
FarItem(ldr:FarStream, index:String, os:int = -1, sz:int = -1, compressed:Boolean = false)
Don't use the constructor directly - use the FarStream.item method instead.
FarItem
  
asBitmap(context:LoaderContext = null):Bitmap
Get the item file data as a Bitmap.
FarItem
  
asMovieClip(context:LoaderContext = null):MovieClip
Get the item file data as a MovieClip.
FarItem
  
asText():String
Get the item file data as a String.
FarItem
Events
 Event Summary Defined By
  Dispatched when the loader has finished uncompressing an item in the archive.FarItem
  Dispatched when the loader has fully finished loading and possibly uncompressing an item from the archive.FarItem
  Dispatched when the loader is about the uncompress an item in the archive.FarItem
  Dispatched when an item was not found in the arhive's file table.FarItem
  Dispatched when file data for this item is being read from the arhive.FarItem
Property Detail
bytesLoadedproperty
bytesLoaded:Number  [read-only]

Number of (possibly compressed) bytes read from the archive thus far.


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

Total item file data size (possibly compressed) as stored in the archive. Will return -1 if the item isn't in the archive, or if the arhive's file table has not been loaded yet.


Implementation
    public function get bytesTotal():Number
compressedproperty 
compressed:Boolean  [read-only]

True if the file data belonging to this item is compressed in the archive.


Implementation
    public function get compressed():Boolean
dataproperty 
data:ByteArray  [read-only]

Item file data, as loaded thus far from the archive.


Implementation
    public function get data():ByteArray
indexproperty 
index:String  [read-only]

The string uniquely identifying this item in the FAR archive.


Implementation
    public function get index():String
loadedproperty 
loaded:Boolean  [read-only]

True if the file data belonfing to this item has fully loaded from the archive.


Implementation
    public function get loaded():Boolean
Constructor Detail
FarItem()Constructor
public function FarItem(ldr:FarStream, index:String, os:int = -1, sz:int = -1, compressed:Boolean = false)

Don't use the constructor directly - use the FarStream.item method instead.

Parameters
ldr:FarStream — managing the FAR file containing the item
 
index:String — item index in archive
 
os:int (default = -1) — of file data in archive
 
sz:int (default = -1) — of file data in archive
 
compressed:Boolean (default = false)

See also

Method Detail
asBitmap()method
public function asBitmap(context:LoaderContext = null):Bitmap

Get the item file data as a Bitmap. Throws an exception if no data has been loaded yet.

Parameters

context:LoaderContext (default = null)

Returns
Bitmap
asMovieClip()method 
public function asMovieClip(context:LoaderContext = null):MovieClip

Get the item file data as a MovieClip. Throws an exception if no data has been loaded yet.

Parameters

context:LoaderContext (default = null)

Returns
MovieClip
asText()method 
public function asText():String

Get the item file data as a String. Throws an exception if no data has been loaded yet.

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

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

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.
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.
ioError Event  
Event Object Type: flash.events.IOErrorEvent
IOErrorEvent.type property = flash.events.IOErrorEvent.IO_ERROR

Dispatched when an item was not found in the arhive's file table.

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

Dispatched when file data for this item is being read from the arhive.