[swfmill] Wrapping of SVG elements

Gerrit Karius g99k at hotmail.com
Mon Jul 24 17:37:36 EDT 2006


Hi, I've been parsing Inkscape SVGs into my movies for a while, and just 
discovered that I can import them statically with SWFMILL. I think this is 
just great, and I'd like to thank all the contributors!

However, I'd like to dynamically access the inner assets of those SVGs, and 
there are some issues with that. I'm new to this group, so please don't bite 
me.

This would be a part of the SVG:


<g id="group1" transform="...">
	<path id="path2" />
</g>


And this is roughly what I'd get from the SWFMILL import:
(The group and path elements get wrapped in sprites, the id names are given 
to the wrappers, and inner elements are defined and exported inside their 
containers.)


<!-- group -->
<DefineSprite objectID="1">
	<!-- path -->
	<DefineShape objectID="2" />
	<!-- path wrapper "path2" -->
	<DefineSprite objectID="22">
		<PlaceObject2 objectID="2" name="path2" />
	</DefineSprite>
	<PlaceObject2 objectID="22" />
	<Export>
		<Symbol objectID="22" name="path2" />
	</Export>
</DefineSprite>
<!-- group wrapper "group1" -->
<DefineSprite objectID="11">
	<PlaceObject2 objectID="1">
		<Transform>...</Transform>
	</PlaceObject2>
</DefineSprite>
<PlaceObject2 objectID="11" name="group1" />
<Export>
	<Symbol objectID="11" name="group1" />
</Export>


Problems with that:

1. The definitions and exports of inner elements are placed inside the 
container's definitions. That way, they aren't globally accessible if the 
container is not on the stage. I wrote an xsl sheet to flatten the 
definitions afterwards, so it's not a major concern.

2. The id names are given to the wrappers. Paths need to be wrapped anyway, 
since only sprites can be named in the SWF. But the wrapping of group 
elements messes up the structure: "group1" had a child "path2" in the SVG, 
but in the SWF it has an unnamed child (which becomes "instance22"). Is 
there a reason why groups should be wrapped?

3. Since the transform of "group1" is included in the wrapper, it is cloned 
when new instances of "group1" are created. I'm unsure if outer transforms 
should be cloned. The SVG spec seems to say "yes", but Inkscape ignores the 
transform when creating new clones. I think ignoring it is more logical, and 
also fits the SWF format better. Does anyone have any clues to this 
question?

I'm about to hack into the "simple-svg.xslt" sheet. If anyone else is 
interested in resolving these issues, please feed me some suggestions.


Cheers,
Gerrit





More information about the swfmill mailing list