My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Links
  • External links
  • hxis


XML based swf, swc and abc assembler written in haXe.
(Available in as3, haxe, neko, cpp, php, javascript, xml)



LIB example: (zip)

<lib>
	<bitmapdata file="haxe.png" class="MyBitmapData"/>
	<bitmap file="haxe.png" class="MyBitmap"/>
	<sprite file="haxe.png" class="MySprite"/>
	<movieclip file="haxe.png" class="MyMovieClip"/>
	<button file="haxe.png" class="MySimpleButton"/>
	<bytearray file="haxe.png" class="MyByteArray"/>
	<sound file="chopin.mp3" class="MySound"/>
	<font file="chopin.ttf" class="MyFont" glyphs="32-125"/>
</lib>
> hxswfml xml2lib library.xml library.swf





SWF example: (zip)

<swf>
	<SetBackgroundColor color="0xFFFFFF" />
	<DefineShape id="1" >
		<BeginFill color="0x000000" alpha="1.0" />
		<DrawRect x="0" y="0" width="100" height="100" />
	</DefineShape>
	<PlaceObject id="1" depth="1" />
	<ShowFrame/>
</swf>


> hxswfml xml2swf index.xml index.swf




ABC example: (zip)

<abcfile>
	<class name="Main" extends="flash.display.MovieClip" >
		<var name="nr" type="int" value="100" />
		<function name="Main" args="" return="void" >
			<OFindPropStrict v="trace" />
			<OThis/>
			<OGetProp v="nr"/>
			<OCallPropVoid v="trace" nargs="1" />
			<ORetVoid />
		</function>
	</class>
</abcfile>


> hxswfml abc2swf abc.xml index.swf -main Main




Binaries are available for:
  • Flash (swf, swc)
  • Air (swc)
  • Cpp (exe)
  • NekoVM (n, exe)
Source is available in:
  • as3
  • haxe
  • neko
  • cpp
  • php
  • javascript
  • xml
Commands in commandline versions:
  • xml2swf
  • xml2lib
  • xml2swc
  • xml2abc
  • abc2swf
  • abc2swc
  • abc2xml
  • abc2hxm
  • xml2hxm
  • ttf2swf
  • ttf2hx
  • ttf2path
  • flv2swf


LIB: XML Schema:

<lib version="10" width="800" height="600" fps="30" backgroundcolor="0xffffff" frameCount="1" actionscript3="true" compressed="false" useDirectBlit="false" useGPU="false" hasMetaData="false" useNetWork="false" >
	<!-- flash.display.BitmapData -->
	<bitmapdata file="*.gif,jpg,png" link/class="MyBitmapData"/>
	
	<!-- flash.display.Bitmap -->
	<bitmap	file="*.gif,jpg,png" link/class="MyBitmap"/>
	
	<!-- flash.display.Sprite -->
	<sprite	file="*.gif,jpg,png" link/class="MySprite"/>
	
	<!-- flash.display.MovieClip -->
	<movieclip file="*.gif,jpg,png" link/class="MyMovieClip"/>
	
	<!-- flash.display.SimpleButton -->
	<button	file="*.gif,jpg,png" link/class="MySimpleButton"/>
	
	<!-- flash.utils.ByteArray -->
	<bytearray file="*.*" link/class="MyByteArray"/>
	
	<!-- flash.media.Sound -->
	<sound file="*.mp3" link/class="MySound"/>
	
	<!-- flash.text.Font -->
	<font file="*.ttf,otf" link/class="MyFont" glyphs="32-125,200-255" name="Arial"/>
	
	<abc file="*.swf,abc" link="MyClass" />
</lib>




SWF: XML Schema:

<?xml version="1.0" ?>
<swf width="800" height="600" fps="30" version="10" compressed="true" frameCount="1" >
	
	<FileAttributes actionscript3="true" useNetwork="false" useDirectBlit="false" useGPU="false" hasMetaData="false" />
	
	<SetBackgroundColor color="0xFFFFFF" />
	
	<ScriptLimits maxRecursionDepth="256" scriptTimeoutSeconds="15" />

	<MetaData file="path/to/file/containing/rdf_metadata *.txt, *.xml" />
	
	<DefineBitsJPEG id="?" file="path/to/file *.jpg, *.png, *.gif" />
	
	<DefineBinaryData id="?" file="path/to/file *.any " />
	
	<DefineSound id="?" file="path/to/file *.mp3" />
	
	<DefineFont id="?" file="path/to/swf/containing/file *.swf, *.ttf", *.otf, charCodes="32-127" name="Arial"/>
	
	<DefineEditText id="?" initialText="" fontID="" useOutlines="false"  width="100" height="100" wordWrap="true" multiline="true" password="false" input="false" autoSize="false" selectable="false" border="false" wasStatic="false" html="false" fontClass="" fontHeight="12" textColor="0x000000" alpha="1.0" maxLength="0" align="0" leftMargin="0" rightMargin="0" indent="0" leading="0" variableName="" file="" />

	<DefineShape id="?" bitmapId="?" x="0" y="0" scaleX="1.0" scaleY="1.0" rotate0="0.0" rotate1="0" repeat="false" smooth="false" />
	
	<DefineShape id="?">
		<LineStyle width="0.0" color="0x000000" alpha="1.0" pixelHinting="false" scaleMode="none/horizontal/vertical" caps="round/square)" joints="round/bevel/miter)" miterLimit="0.0" noClose="false"/>
		<BeginFill color="0x000000" alpha="1.0" />
		<BeginBitmapFill bitmapId="?" x="?" y="?" scaleX="?" scaleY="?" rotate0="?" rotate1="?" repeat="false" smooth="false"/>
		<BeginGradientFill colors="?,?,?" alphas="?,?,?" ratios="?,?,?" x="?" y="?" scaleX="?" scaleY="?" rotate0="?" rotate1="?"/>
		<MoveTo x="0.0" y="0.0" />
		<LineTo x="0.0" y="0.0" />
		<CurveTo cx="0.0" cy="0.0" ax="0.0" ay="0.0" />
		<DrawCircle x="0.0" y="0.0" r="0.0" sections="16" />
		<DrawEllipse x="0.0" y="0.0" width="0.0" height="0.0" />
		<DrawRect x="0.0" y="0.0" width="0.0" height="0.0" />
		<DrawRoundRect x="0.0" y="0.0" width="0.0" height="0.0" r="0.0"/>
		<DrawRoundRectComplex x="0.0" y="0.0" width="0.0" height="0.0" rtl="0.0" rtr="0.0" rbl="0.0" rbr="0.0" />
		<EndLine />
		<EndFill />
	</DefineShape>

	<DefineSprite id="?" file="path/to/file/ *.flv">

	<DefineSprite id="?" frameCount="1">
		<PlaceObject id="?" depth="?" name="" move="false" x="0" y="0" scaleX="1.0" scaleY="1.0" rotate0="0.0" rotate1="0.0" />
		<RemoveObject depth="?" />
		<StartSound id="?" stop="false" loopCount="0" />
		<Custom tagId="?" file="path/to/file/containing/tagbody bytes" data="?" comment=""/>
		<FrameLabel name="?" anchor="false" />
		<Tween depth="?" frameCount="?"></Tween>
		<ShowFrame />
	</DefineSprite>
	
	<DefineButton id="?">
		<ButtonState id="?" depth="?" up="true" over="false" down="false"  hit="false" x="0" y="0" scaleX="1.0" scaleY="1.0" rotate0="0.0" rotate1="0.0" />
	</DefineButton>

	<DefineScalingGrid id="?" x="?" width="?" y="?" height="?" />

	<PlaceObject id="?" depth="?" name="" move="false" x="0" y="0" scaleX="1.0" scaleY="1.0" rotate0="0.0" rotate1="0.0" />
	
	<RemoveObject depth="?" />
	
	<StartSound id="?" stop="false" loopCount="0" />

	<FrameLabel name="?" anchor="false" />

	<Custom tagId="?" file="path/to/file/containing/tagbody bytes" data="?" comment=""/>

	<DefineABC (file="path/to/file/containing/abc.xml,.swf" isBoot="false")>
		<ABCfile>
			<import name="?"/>
			<class  name="?" extends="?" implements="" interface="false" sealed="false>
				<var name="?" type="" value="" const="false" static="false" ns=""/>
				<function  name="?" args="" return="*" kind="normal/get/set" static="false" final="false" variableArgs="false" defaultParameters="" locals="" argumentsDefined="false" override="false" ns="" native="false" usesDXNS="false" newBlock="false" unused="false" debugName="" maxStack="" maxScope="">
					<OThis />
					<OScope />
					<!-- opcodes* -->
					<ORetVoid />
				</function>
			</class>
		</ABCfile>
	</DefineABC >

	<SymbolClass id="?" class="?" base="" />

	<Tween depth="?" frameCount="?">
		<Tw prop="x/y/scaleX/scaleY/rotate0/rotate1" start="?" end="?" />
	</Tween>

	<ShowFrame count="1"/>
</swf>

*opcodes



ABC: XML Schema:



To run hxswfml.n you need the Neko VM which can be downloaded here:http://nekovm.org/download
To compile hxswfml from source you need the haXe compiler which can be downloaded here: http://haxe.org/download

See wiki for more info and also the examples.zip. It contains 50 to 100 examples which should explain most.
Linking classes to assets
SWFTags
SWF All examples(50MB):(zip)



Currently supported swf tags are:
  • fileAttributes
  • setBackgroundcolor
  • scriptLimits
  • metadata
  • defineBitsJpeg2
  • defineShape
  • defineShape2
  • defineShape3
  • defineShape4
  • defineSprite
  • defineButton
  • defineVideoStream
  • defineVideoFrame
  • defineFont
  • defineFont2
  • defineFont3
  • defineFont4
  • defineEdittext
  • defineAbc
  • defineScalinggrid
  • defineSound
  • soundStreamHead2
  • soundStreamBlock
  • placeObject
  • placeObject2
  • removeObject
  • removeObject2
  • startSound
  • symbolClass
  • exportAssets
  • frameLabel
  • showFrame
  • endFrame
  • custom
  • tween

Links to additional information about the used swf tags:
SWF File Format Specification (Version 10) : http://www.adobe.com/devnet/swf/

  • swfheader 1 3
  • fileattributes 1
  • setbackgroundcolor 1 2 3
  • scriptlimits 1
  • metadata 1
  • definebitsjpeg 1 2
  • defineshape 1 2 3
  • definesprite 1 2 3
  • definebutton 1 2 3
  • definebinarydata 1
  • definesound 1 2
  • definefont 1 2 3
  • defineedittext 1 2 3
  • defineabc 1
  • definescalinggrid 1

  • placeobject 1 2 3
  • removeobject 1 2 3
  • startsound 1 2
  • tween
  • symbolclass 1

  • framelabel 1 2 3
  • showframe 1 2 3
  • endframe 1 2 3
Powered by Google Project Hosting