[swfmill] Accessing swfmlill library assets (png, mp3) from Flex/as3

armencho at gmail.com armencho at gmail.com
Fri Nov 6 04:12:06 PST 2009


Ok, I have spent a couple of hours on this, and fount out the following.

In order to instantiate classes (which include images for new virtual
machine) dynamically (using ApplicationDomain::getDefinition or
flash.utils.getDefinitionByName) your child/library SWF not only has
to containe the assets, as described by your swfmill source xml, but
also has to actually export what is known as "class stubs". These are
descriptions of classes that are bound to the image data. The bitmap
you are defining for example is expected to be linked to a class
extending a BitmapData.

The problem is, swfmill does not automatically generate these class
stubs for you, when you compile swfs from your xmls.

The full swfmill format specification may allow for writing these
class stubs manually though, but I have not been able to write them
myself, because that would require some indepth knowledge of the SWF
format, which I do not have, not to the required degree anyway.

Basically, your library SWF does include the image, but since it does
not include information on the class you are tring to find with
getDefinition, it cannot find the class :-)

You can try a tool called SamHaxe which is a direct alternative to
swfmill, and promises more things, and I have read that it generates
class stubs automatically.

Maybe Daniel can elaborate on this issue, as to if it is feasable to
use swfmill for the purpose, and what is the best way to do this?

2009/11/6 Jonas Nyström <jonasnys at gmail.com>:
> Hi Armencho!
>
> The xml is just as described, nothing more:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <movie version="10">
>     <frame>
>         <library>
>             <bitmap id="library.TestBitmap" import="assets/test.png"/>
>         </library>
>     </frame>
> </movie>
>
> The command line just plain
>>swfmill simple test.xml SMLibrary.swf
>
>
>
>
>



More information about the swfmill mailing list