Packageorg.si.utils
Classpublic class ByteArrayExt
InheritanceByteArrayExt Inheritance flash.utils.ByteArray

Extended ByteArray, png image serialize, IFF chunk structure, FileReference operations.



Public Methods
 MethodDefined by
  
ByteArrayExt(copyFrom:ByteArray = null)
constructor
ByteArrayExt
  
browse(onComplete:Function = null, onCancel:Function = null, onError:Function = null, fileFilterName:String = null, extensions:String = null):void
Call FileReference::browse().
ByteArrayExt
  
calculateCRC32(byteArray:ByteArray, offset:int = 0, length:int = 0):uint
[static] calculate crc32 chuck sum
ByteArrayExt
  
fromBitmapData(bmd:BitmapData):ByteArrayExt
translate from BitmapData
ByteArrayExt
  
load(url:String, onComplete:Function = null, onCancel:Function = null, onError:Function = null):void
load from URL
ByteArrayExt
  
read all IFF chunks from current position.
ByteArrayExt
  
readChunk(bytes:ByteArray, offset:int = 0, searchChunkID:String = null):*
read (or search) IFF chunk from current position.
ByteArrayExt
  
save(defaultFileName:String = null, onComplete:Function = null, onCancel:Function = null, onError:Function = null):void
Call FileReference::save().
ByteArrayExt
  
toBitmapData(width:int = 0, height:int = 0, transparent:Boolean = true, fillColor:uint = 0xFFFFFFFF):BitmapData
translate to BitmapData
ByteArrayExt
  
toPNGData(width:int = 0, height:int = 0):ByteArrayExt
translate to 24bit png data
ByteArrayExt
  
writeChunk(chunkID:String, data:ByteArray, listType:String = null):void
write IFF chunk
ByteArrayExt
Constructor detail
ByteArrayExt()constructor
public function ByteArrayExt(copyFrom:ByteArray = null)

constructor

Parameters
copyFrom:ByteArray (default = null)
Method detail
browse()method
public function browse(onComplete:Function = null, onCancel:Function = null, onError:Function = null, fileFilterName:String = null, extensions:String = null):void

Call FileReference::browse().

Parameters
onComplete:Function (default = null) — handler for Event.COMPLETE. The format is function(bae:ByteArrayExt) : void.
 
onCancel:Function (default = null) — handler for Event.CANCEL. The format is function(e:Event) : void.
 
onError:Function (default = null) — handler for Event.IO_ERROR. The format is function(e:IOErrorEvent) : void.
 
fileFilterName:String (default = null) — name of file filter.
 
extensions:String (default = null) — extensions of file filter (like "jpg;png;gif").
calculateCRC32()method 
public static function calculateCRC32(byteArray:ByteArray, offset:int = 0, length:int = 0):uint

calculate crc32 chuck sum

Parameters
byteArray:ByteArray
 
offset:int (default = 0)
 
length:int (default = 0)

Returns
uint
fromBitmapData()method 
public function fromBitmapData(bmd:BitmapData):ByteArrayExt

translate from BitmapData

Parameters
bmd:BitmapData — BitmapData translating from.

Returns
ByteArrayExt — this instance
load()method 
public function load(url:String, onComplete:Function = null, onCancel:Function = null, onError:Function = null):void

load from URL

Parameters
url:String — URL string to load swf file.
 
onComplete:Function (default = null) — handler for Event.COMPLETE. The format is function(bae:ByteArrayExt) : void.
 
onCancel:Function (default = null) — handler for Event.CANCEL. The format is function(e:Event) : void.
 
onError:Function (default = null) — handler for Event.IO_ERROR. The format is function(e:IOErrorEvent) : void.
readAllChunks()method 
public function readAllChunks():*

read all IFF chunks from current position.

Returns
*
readChunk()method 
public function readChunk(bytes:ByteArray, offset:int = 0, searchChunkID:String = null):*

read (or search) IFF chunk from current position.

Parameters
bytes:ByteArray
 
offset:int (default = 0)
 
searchChunkID:String (default = null)

Returns
*
save()method 
public function save(defaultFileName:String = null, onComplete:Function = null, onCancel:Function = null, onError:Function = null):void

Call FileReference::save().

Parameters
defaultFileName:String (default = null) — default file name.
 
onComplete:Function (default = null) — handler for Event.COMPLETE. The format is function(e:Event) : void.
 
onCancel:Function (default = null) — handler for Event.CANCEL. The format is function(e:Event) : void.
 
onError:Function (default = null) — handler for Event.IO_ERROR. The format is function(e:IOErrorEvent) : void.
toBitmapData()method 
public function toBitmapData(width:int = 0, height:int = 0, transparent:Boolean = true, fillColor:uint = 0xFFFFFFFF):BitmapData

translate to BitmapData

Parameters
width:int (default = 0) — same as BitmapData's constructor, set 0 to calculate automatically.
 
height:int (default = 0) — same as BitmapData's constructor, set 0 to calculate automatically.
 
transparent:Boolean (default = true) — same as BitmapData's constructor.
 
fillColor:uint (default = 0xFFFFFFFF) — same as BitmapData's constructor.

Returns
BitmapData — translated BitmapData
toPNGData()method 
public function toPNGData(width:int = 0, height:int = 0):ByteArrayExt

translate to 24bit png data

Parameters
width:int (default = 0) — png file width, set 0 to calculate automatically.
 
height:int (default = 0) — png file height, set 0 to calculate automatically.

Returns
ByteArrayExt — ByteArrayExt of PNG data
writeChunk()method 
public function writeChunk(chunkID:String, data:ByteArray, listType:String = null):void

write IFF chunk

Parameters
chunkID:String
 
data:ByteArray
 
listType:String (default = null)