Posts Tagged swfmill

things I learned about haxe from the papervision demo: swfmill

A while back I wrote about haxe and papervision which basicly said “golly!”

The fact that it works is great, but there were a few things that were a little mysterious to me and some of the code organization of the demo wasn’t quite in my style, so I refactored it a bit. Some of the olde “take it apart, put it back together” gag.

One of the things that mystified me was this:

class Haxe extends MovieClip {}
class Baidu extends MovieClip {}
class Google extends MovieClip {}
class Yahoo extends MovieClip {}

There was also some XML like so:

     <?xml version="1.0" encoding="iso-8859-1" ?>
     <movie version="9" width="600" height="500" framerate="60">
         <background color="#000000"/>
           <frame>
               <library>
                   <clip id="Baidu"  import="baidu.png"/>
                   <clip id="Google" import="google.png"/>
                   <clip id="Yahoo"  import="yahoo.png"/>
                   <clip id="Haxe"   import="haxe.png"/>
               </library>
           </frame>
     </movie>
 

And a broken link.

How did this magic work? It was obviously a way to declaritively create MovieClips that you can reference in Haxe! Neat!

Well… after poking around some of the googoo I came to the new haxe documentation for this functionality.

I renamed 4 random png’s to match the xml and saved the xml to fu.xml. Then I ubuntu’d it up:

 % sudo apt-get install swfmill
 % cp -i lib.swf original.lib.swf
 % swfmill xml2swf fu.xml
 doesn't seem to be a swfml file
 no SWF loaded to save

Bummer… so I cried out “Googoo! Help me!” and low and behold! The way was made clear:

 * % swfmill simple fu.xml lib.swf
 * % haxe jiggy.hxml

Neat! Worx a treat!

Leave a Comment