Click and Fill with Color

Is there a way to programatically fill an outlined area of an image with a specific color?
I’m wanting to make a page online where kids can click and color in black and white picture.

FloodFill will be an answer.

1 Like

To your knowledge, is there a way to increase the intensity of the fill? This works well, but there are still white pixels near where black lines are (the filling functions is not completely filling the white space).

You probably should “manually” check for white (or whatever color is) pixels and fill it with desired color.

When I program such games I split each section into a separate movieclips. And then color the movieclip on mouse hit. That can be achived using this simple code

   var myColorTransform:ColorTransform = new ColorTransform();
   myColorTransform.color = color ; 
   mc.transform.colorTransform = myColorTransform ;

Great idea. Do you do the separation at run time or load them in as separate bitmaps?

For now I only do it in within the animate cc IDE
But if you want to do it via code. Then you will first need to colour all the parts with separate values and store it as bitmap. And then load that bitmap and with those hex values in an array you can separate each part using pixel manipulation code and put it inside a movieclip.
These separate movieclips will layer and coincide above the full-bitmap ( without any color ), with alpha=0. Whenever the user hits one of the movieclip, color it with the active color, and make alpha=1.

@bking20 if you still looking for nice solution, here it is