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;
}
Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Страница 1: ...ActionScript 2 0 Language Reference ...
Страница 1352: ...1352 ActionScript classes ...