How do you detect an area that can be filled in in a bitmap in ActionScript 3?
- by 1.21 gigawatts
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"/>