Flash 8 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > BitmapData (flash.display.BitmapData) > floodFill (BitmapData.floodFill method) | |||
public floodFill(x:Number, y:Number, color:Number) : Void
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);
}
Version 8
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/8/main/00001952.html
Comments
No screen name said on Sep 18, 2005 at 10:43 AM : Ćukasz Grela said on Nov 5, 2005 at 4:08 PM :