Skip navigation
Currently Being Moderated

How do I create a Custom/Odd Shaped Mask for Odd-Shaped DisplayObject's?

Apr 6, 2013 3:51 PM

Tags: #custom #mask #sprite #irregular #displayobject #tranparent #odd_shaped

I want to create a Sprite with a custom transparent area...


all of the examples I've found using the 'mask' property of a DisplayObject 'cheat' by creating either a rectangle or an oval as a Shape and use it as a mask... this is 'cheating' because these are very primitive convex shapes that have no holes, and 'graphics' doesn't draw any pixels that aren't shown, so there is no portion of the mask itself where 'this portion is transparent and this portion is opaque'... and such masks have no holes in them...


i want, for example, to take a bitmap image of a dog and have a 'mask' that conforms precisely to the dog's visible shape... or something with see-through holes in it... the application doesn't need to figure out the mask shape on the fly, i'm fine with providing the mask shape at design time... but how do i provide this shape?


in the past, either a specific color was designated as the transparent color (no mask needed)... or a 'mask' was an associated rectangle of the same height and width as the bitmap image with black meaning transparent and white (on any color other than black) was opaque...


so how does one create such a custom/odd shaped mask in ActionScript/Flash Pro? put another way, how does one create iregular-shaped sprites?

  • Currently Being Moderated
    Apr 6, 2013 3:55 PM   in reply to Peteroid

    One way would be to use the brush tool and draw the shape.  Another would be to take a bitmapo of the object and convert it to a vector drawing and then whittle away the portions that you do not want showing

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points