[swfmill] SWF to SVG
Gerrit .
g99k at hotmail.com
Thu Jan 3 05:45:42 PST 2008
Hello, and a happy new year to everyone!
I had worked on the SVG import before, but now I'm in need of an SVG export. I am doing some tweening with Apache Batik, but my peers will only use the Flash IDE to produce the assets.
I therefore wrote a little swf2svg XSLT stylesheet to convert SWFML files to SVG. I am mainly interested in the transformation matrices and labels from keyframes, so the XSLT pretty much does what I need already. I post it here, unpolished, in case anyone has some use for it.
If you know an XSLT solution to some of he current shortcomings, please post some suggestions. Ultimately, some calls to C++ function might be needed.
TODO list:
1. Only simple shapes with one fill are supported. SWF's second fillstyle is not supported by SVG, so complex shapes would have to be broken apart into simple ones. Right now, they just look messy.
2. Gradients are not supported, the stylesheet simply picks the first color. This one isn't too hard, I might implement it later.
3. Frames are converted to Inkscape layers, with only the first one visible. Bulya Biak suggested this, as SVG doesn't directly support frames. So far, only frames of the main movie are supported. As SWF frame tags aren't ancestors, but siblings of the frames' contents, the code is quite messy already.
4. SWF doesn't specify each frame's content, but only changes to the previous frames. Hence, the correct way to parse frames would be to generate each frame incrementally, based on the previous output. Afaik accessing previous output is impossible in XSLT, so I'm using preceding-sibling. Currently, unchanged objects don't appear in the next frame, as there's no tag to be parsed.
5. Depths are ignored. Luckily, the tags are usually in the right order.
6. The symbol names that are exported for ActionScript get lost. Instead, the objectIDs (i.e. numbers) are used as SVG ids. The exports appear out of context to the actual symbols, so it might be hard to combine the two with XSLT.
If anyone of you has tried other swf2svg solutions, please share your experiences.
Cheers,
Gerrit
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: swf2svg.xslt
Type: application/octet-stream
Size: 8364 bytes
Desc: not available
Url : http://osflash.org/pipermail/swfmill_osflash.org/attachments/20080103/b42d7074/attachment.obj
More information about the swfmill
mailing list