function sketch() {
myBitmapData.setPixel(_xmouse, _ymouse, 0x000000);
}
See also
getPixel (BitmapData.getPixel method)
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
method takes an ARGB color value that contains alpha channel information.
Availability: ActionScript 1.0; Flash Player 8
Parameters
- The x position of the pixel whose value changes.
x:Number
- The y position of the pixel whose value changes.
y:Number
- The ARGB color to which to set the pixel. If you created an opaque (not a
color:Number
transparent) bitmap, the alpha transparency portion of this color value is ignored.
Example
The following example uses the
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;
}
328
ActionScript classes
method; the main difference is that the
setPixel()
setPixel32()
,
setPixel32 (BitmapData.setPixel32
method to assign an ARGB value to a pixel at
setPixel32()
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?