Binary.hx

Binary import module for importing arbitrary data with optional zlib compression.

Summary
Binary.hxBinary import module for importing arbitrary data with optional zlib compression.
binaryImports arbitrary data as DefineBinaryData swf tag.

binary

Imports arbitrary data as DefineBinaryData swf tag.

Mandatory attributes

importPath to the file to be imported.
classClass name assigned to imported data.

Optional attributes

genclass(false, symbolOnly, symbolAndClass) Controls the generation of symbols and AS3 class stubs.  Available values are: false (don’t generate neither symbol nor AS3 class stub), symbolOnly (generate only symbol), symbolAndClass (generate symbol and AS3 class stub)
compress(false, true) Controls the compression of imported data.

Superclass

flash.utils.ByteArrayThe superclass of AS3 class stub.

Example 1

Assuming that Binary import module is assigned to namespace bin the following snippet imports and then compresses /data/list.txt, exports it with symbolclass name resources.NameList and generates a corresponding AS3 class stub (default behavior):

<bin:binary import="/data/list.txt" class="resources.NameList" compress="true"/>

Example 2

Manual creation of class stub.  First import the file with genclass set to symbolOnly

<bin:binary import="/data/list.txt" class="resources.NameList" genclass="symbolOnly" compress="true"/>

then define the class stub in haXe:

package resources;

class NameList extends flash.utils.ByteArray {
   public function new() {
      super();
   }
}
Close