Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > BitmapData (flash.display.BitmapData) > floodFill (BitmapData.floodFill method) | |||
Performs a flood fill operation on an image starting at an (x, y) coordinate and filling with a certain color. The floodFill() method is similar to the paint bucket tool in various painting programs. The color is an ARGB color that contains alpha information and color information.
Availability: ActionScript 1.0; Flash Player 8
x:Number - The x coordinate of the image.
y:Number - The y coordinate of the image.
color:Number - The ARGB color to use as a fill. ARGB colors are often specified in hexadecimal format, like 0xFF336699.
The following example shows how to apply a flood fill a color into to an image starting at the point where a user clicks the mouse within a BitmapData object.
import flash.display.BitmapData;
import flash.geom.Rectangle;
var myBitmapData:BitmapData = new BitmapData(100, 80, false, 0x00CCCCCC);
var mc:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mc.attachBitmap(myBitmapData, this.getNextHighestDepth());
myBitmapData.fillRect(new Rectangle(0, 0, 50, 40), 0x00FF0000);
mc.onPress = function() {
myBitmapData.floodFill(_xmouse, _ymouse, 0x000000FF);
}
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00001404.html