EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Floodfill (Bitmapdata.floodfill Method)

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
310 ActionScript classes
See also
Rectangle (flash.geom.Rectangle)
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
Parameters
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.
Example
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);
}

Table of Contents

Related product manuals