How do you detect an area that can be filled in in a bitmap in ActionScript 3?
Posted
by
1.21 gigawatts
on Stack Overflow
See other posts from Stack Overflow
or by 1.21 gigawatts
Published on 2011-01-07T03:07:29Z
Indexed on
2011/01/07
5:54 UTC
Read the original article
Hit count: 180
I am having a tough time figuring this out. I need to be able to detect a fill area for something similar to a coloring book picture. The user will click inside the area that needs to be filled. The image is user created bitmap content and so the fill area must be detected at runtime. Any help would be tremendously appreciated!
Posting Flex 4 code for review:
<fx:Script>
<![CDATA[
protected function myImage_clickHandler(event:MouseEvent):void
{
myImage.imageDisplay.bitmapData.floodFill(event.localX,event.localY,0xFFFFFF);
}
]]>
</fx:Script>
<s:Image id="myImage" click="myImage_clickHandler(event)" source="/images/square.gif"/>
© Stack Overflow or respective owner