On Mon, Feb 9, 2009 at 7:47 PM, Todd Kerpelman <t...@kerp.net> wrote:
> Hey, coders!
>
> I have a Sprite that consists of a polygon that I drew in Flash (using the
> line tool) and saved into my Library.
>
> Using ActionScript, is there any way to easily find the points of said
> polygon? It seems like I oughta be able to dig up those line coordinates out
> of my Sprite.graphics object, but I can't seem to find a way of doing it...

You'll end up reading the coordinates from inside the Flash IDE or by
using a tool like Swfmill, but just for sports, and with the
limitation that it needs to be convex, this is the easiest way I can
think of:

Rotate it slowly. Use getRect to find out how far it extends towards,
say, the right, at a given rotation. When that distance decreases,
it's a point, and you can calculate its coordinate via the distance
and rotation. Repeat until you've made a full turn.

If it's not convex, I guess you'd need to trace it...

Mark
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to