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.
| import | Path to the file to be imported. |
| class | Class name assigned to imported data. |
| 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) |
| flash.display.MovieClip | The superclass of the AS3 class stub. |
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"/>
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();
}
}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.
| import | Path to the file to be imported. |
| 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. |
No AS3 class stub is generated.
Assuming that Swf import module is assigned to namespace swf the following snippet imports extlib.swf as a library:
<swf:library import="extlib.swf"/>