;

PDA

Click to See Complete Forum and Search --> : A method to dynamically change the outline of a sprite?


dcnguyen
10-17-2008, 02:27 PM
So I've a bunch of pngs I'm loading into sprites that are the shapes of countries...these pngs are solid colors...I'd like to, inside my program, just highlight the outlines of these shapes...Is there anyway to do this dynamically, rather than creating files for both outlines and fills of these countries and loading both in?

5TonsOfFlax
10-17-2008, 02:54 PM
You should be able to apply a ConvolutionFilter with a "find edges" matrix to extract the edges in your pngs.

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/filters/ConvolutionFilter.html

http://homepages.inf.ed.ac.uk/rbf/HIPR2/sobel.htm

dcnguyen
10-17-2008, 03:42 PM
Thanks, that did the trick? Is there a streamlined way to just store the outline produced by applying the filter into another Sprite, other than duplicating the sprite, applying the filter, and then somehow deleting the fill shape?

5TonsOfFlax
10-17-2008, 03:49 PM
Draw your Sprite into a BitmapData, then use applyFilter on that BitmapData to get the edges.