Swf.hx

Swf import module for importing other swf asset libraries

Summary
Swf.hxSwf import module for importing other swf asset libraries
swfImports tags from SWF files and rewrites character IDs to avoid ID collisions.
libraryProvides almost the same functionality as swf except it doesn’t import stage manipulation tags at all.

swf

Imports tags from SWF files and rewrites character IDs to avoid ID collisions.  Every SWF tag supported by format.swf are parsed, rewritten (if needed) and then serialized again.  SWF tags concerning direct stage manipulation (PlaceObjectX for example) are grouped into a DefineSprite tag which is then appended after other tags.

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)

Superclass

flash.display.MovieClipThe superclass of the AS3 class stub.

Example 1

Assuming that Swf import module is assigned to namespace swf the following snippet imports animation.swf as a MovieClip, exports it with symbolclass name resources.Animation and generates a corresponding AS3 class stub (default behavior):

<swf:swf import="animation.swf" class="resources.Animation"/>

Example 2

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

<swf:swf import="animation.swf" class="resources.Animation" genclass="symbolOnly"/>

then define the class stub in haXe:

package resources;

class Animation extends flash.display.MovieClip {
   public function new() {
      super();
   }
}

library

Provides almost the same functionality as swf except it doesn’t import stage manipulation tags at all.  Moreover it doesn’t generates neither symbol class nor AS3 class stubs.  Useful for importing external libraries provided as binary SWF files.

Mandatory attributes

importPath to the file to be imported.

Optional attributes

symbols(false, true) Controls the inclusion of SymbolClass tag entries.  Libraries generated with flex may include some non Sprite based class to character ID mappings which cause runtime errors in flash player.

Superclass

No AS3 class stub is generated.

Example

Assuming that Swf import module is assigned to namespace swf the following snippet imports extlib.swf as a library:

<swf:library import="extlib.swf"/>
Imports tags from SWF files and rewrites character IDs to avoid ID collisions.
Close