[swfmill] Generated name attributes in PlaceObject2 with swfmill simple

Daniel Cassidy mail at danielcassidy.me.uk
Wed Feb 27 14:45:16 PST 2008


Hi all,

I'm working on a project with haXe and swfmill targetting Flash 9. So 
far I'm just importing a few graphics in SVG format, and animating them 
in code, but I must say that I am already highly impressed by the power 
and flexibility of swfmill's SVG import -- kudos to all involved.

However, one thing bothers me: the class corresponding to each SVG 
graphic must explicitly declare an identifier for each top-level node. 
This is a great feature as far as it goes -- I was not expecting to be 
able to manipulate individual components within an imported SVG from 
code. However, it's quite annoying to have to declare identifiers for 
*every* node, particularly when the identifier is auto-generated by 
swfmill. For example, for the following trivial SVG:

<svg width='10' height='10'>
    <rect x='0' y='0' width='10' height='10' fill="#ff0000"/>
</svg>

The corresponding haXe class is as follows:

class ExampleRectangle extends Sprite {
    var id7654321 :Sprite; // compulsory, corresponds to rect above

    public function new () {
    }
}

(where id7654321 is an unpredictable name generated by swfmill).


This is improved by giving the rect an id:
...
    <rect id='rectangle' ...
...
    var rectangle :Sprite; // compulsory, but at least predictable
...

but, if the variable is never going to be used, it seems to me to be 
unnecessarily crufty to be forced to declare it.


The enclosed patch modifies swfmill to not generate a name at all for 
elements without an explicit id attribute or Inkscape label. I couldn't 
see any technical reason why generating a name should be necessary, and 
certainly the patch hasn't broken anything for me so far, but please do 
let me know if I'm missing something.

If not, could the patch please be applied to svn? (Or at least something 
like it -- I have less than an hour's experience with XSLT so it's 
probably unnecessarily messy).


Thanks,
Dan C.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: swfmill-simple-placeobject2-name.patch
Type: text/x-patch
Size: 862 bytes
Desc: not available
Url : http://osflash.org/pipermail/swfmill_osflash.org/attachments/20080227/84709021/attachment.bin 


More information about the swfmill mailing list