Setpixel (Bitmapdata.setpixel Method) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

var mc:MovieClip = this.createEmptyMovieClip("mc",
this.getNextHighestDepth());
mc.attachBitmap(myBitmapData, this.getNextHighestDepth());
myBitmapData.fillRect(new Rectangle(0, 0, 25, 80), 0x00FF0000);
mc.onPress = function() {
myBitmapData.scroll(25, 0);
}

setPixel (BitmapData.setPixel method)

public setPixel(x:Number, y:Number, color:Number) : Void
Sets the color of a single pixel of a BitmapData object. The current alpha channel value of the
image pixel is preserved during this operation. The value of the RGB color parameter is
treated as an unmultiplied color value.
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 RGB color to which to set the pixel.
color:Number
Example
The following example uses the
specific x and y position. You can draw on the created bitmap in 0x000000 by dragging.
import flash.display.BitmapData;
var myBitmapData:BitmapData = new BitmapData(100, 80, false, 0x00CCCCCC);
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;
}
method to assign a RGB value to a pixel at a
setPixel()
BitmapData (flash.display.BitmapData)
327

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF