# Fill color with line boundaries

**URL:** https://forum.kirupa.com/t/fill-color-with-line-boundaries/254985
**Category:** flash
**Created:** [March 18, 2008, 12:03am UTC](https://forum.kirupa.com/t/fill-color-with-line-boundaries/254985 "2008-03-18T00:03:13Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![xavii](https://avatars.discourse-cdn.com/v4/letter/x/ebca7d/32.png) [@xavii](https://forum.kirupa.com/u/xavii)
#### Post date: [March 18, 2008, 12:03am UTC](https://forum.kirupa.com/t/fill-color-with-line-boundaries/254985/1 "2008-03-18T00:03:13Z")

</div>

What i need is the ability to “fill” an area of “color” in an imported image onto the stage to whatever color i need, and for it to fill the entire area until it reaches a boundary.

Now, if your as lost reading that as i was when i typed it, what i need is exactly what you have in mspaint (Microsoft Paint) basically i need my own paint bucket tool, so that i can fill an area of an imported image to whatever color i want.

I have played around with the BitmapData.threshold function, however whilst it works, if a user colors area1 blue, and then area 3 blue, then decides he really wants area 3 red, when he repaints area3 red, he will also paint area1 red too…

Threshold just works too well, i need to re-painting or “filling” to stop when it hits a border, and not change other parts of the image that are the same color.

An example of the image is located here: [http://www.xavierit.com.au/lineDrawing.JPG](http://www.xavierit.com.au/lineDrawing.JPG) i want the user to be able to paint individual cells any color they want, but i cannot find an approprate way of doing this.:m2:
