EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Setpixel (Bitmapdata.setpixel 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...
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;
}

Table of Contents

Related product manuals