A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: A method to dynamically change the outline of a sprite?

  1. #1
    Senior Member
    Join Date
    Mar 2005
    Posts
    206

    A method to dynamically change the outline of a sprite?

    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?

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    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/...ionFilter.html

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

  3. #3
    Senior Member
    Join Date
    Mar 2005
    Posts
    206
    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?

  4. #4
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Draw your Sprite into a BitmapData, then use applyFilter on that BitmapData to get the edges.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center