BitmapData (flash.display.BitmapData)
327
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
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 RGB color to which to set the pixel.
Example
The following example uses the
setPixel()
method to assign a RGB value to a pixel at a
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;
}
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...