[Flashcoders] modifying fills/curves with AS2 at runtime

2008-01-31 Thread Andrew Sinning
In AS2 and CS3, is it possible to make changes to an existing curve at 
runtime?  As far as I know, there isn't even a way to access the various 
primitives within an mc, so I don't think this is doable.  At the very 
least I'd like to be able to change the fill of an existing.  Even 
better I'd like to be able to do is get data about what is in a clip and 
then reproduce it or modify it.


Thanks.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] modifying fills/curves with AS2 at runtime

2008-01-31 Thread Jim Cheng

Andrew Sinning wrote:
In AS2 and CS3, is it possible to make changes to an existing curve at 
runtime?  As far as I know, there isn't even a way to access the various 
primitives within an mc, so I don't think this is doable.  At the very 
least I'd like to be able to change the fill of an existing.  Even 
better I'd like to be able to do is get data about what is in a clip and 
then reproduce it or modify it.


Not if it's pre-drawn and loaded in from the library.  You might be able 
to simulate changing the hue and alpha of the stroke or fill a vector 
shape at run-time if you split the the stroke and fill into separate 
movieclips and then applied filters to them.


If you need more programmatic control of your vector shapes, however, 
you'll need to maintain some sort of representation of the shape in 
Actionscript and draw it at run-time using the Graphics API, redrawing 
the object as necessary to account for dynamic changes.


For AS2, Helen Triolo has done some interesting work in parsing SVG path 
data and rendering it via the Graphics API.  You can read more about 
this and download example code from her website here:


http://www.flash-creations.com/notes/sample_svgtoflash.php

If you're using AS3, Degrafa would be an excellent choice here, as this 
is the exact type of need that the library was meant to fill.  Degrafa 
is particularly nice in that you can define your shape in very readable
MXML and then programmatically make changes to the shape via script 
without having to worry about invalidation and redrawing.  You can find 
out more about Degrafa here:


http://www.degrafa.com/


Jim Cheng
EffectiveUI
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders