EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Setpixel32 (Bitmapdata.setpixel32 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...
328 ActionScript classes
function sketch() {
myBitmapData.setPixel(_xmouse, _ymouse, 0x000000);
}
See also
getPixel (BitmapData.getPixel method), setPixel32 (BitmapData.setPixel32
method)
setPixel32 (BitmapData.setPixel32 method)
public setPixel32(x:Number, y:Number, color:Number) : Void
Sets the color and alpha transparency values of a single pixel of a BitmapData object. This
method is similar to the
setPixel() method; the main difference is that the setPixel32()
method takes an ARGB color value that contains alpha channel information.
Availability: ActionScript 1.0; Flash Player 8
Parameters
x:Number - The x position of the pixel whose value changes.
y:Number - The y position of the pixel whose value changes.
color:Number - The ARGB color to which to set the pixel. If you created an opaque (not a
transparent) bitmap, the alpha transparency portion of this color value is ignored.
Example
The following example uses the
setPixel32() method to assign an ARGB value to a pixel at
a specific x and y position. You can draw on the created bitmap in 0x000000 without an alpha
value by pressing you mouse button and dragging.
import flash.display.BitmapData;
var myBitmapData:BitmapData = new BitmapData(100, 80, true, 0xFFCCCCCC);
var mc:MovieClip = this.createEmptyMovieClip("mc",
this.getNextHighestDepth());
mc.attachBitmap(myBitmapData, this.getNextHighestDepth());
mc.onPress = function() {
this.onEnterFrame = sketch;
}
mc.onRelease = function() {
delete this.onEnterFrame;
}

Table of Contents

Related product manuals