03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Parameters<br />

x:Number - The amount by which to scroll horizontally.<br />

y:Number - The amount by which to scroll vertically.<br />

Example<br />

The following example shows how to scroll a BitmapData object.<br />

import flash.display.BitmapData;<br />

import flash.geom.Rectangle;<br />

var myBitmapData:BitmapData = new BitmapData(100, 80, false, 0x00CCCCCC);<br />

var mc:MovieClip = this.createEmptyMovieClip("mc",<br />

this.getNextHighestDepth());<br />

mc.attachBitmap(myBitmapData, this.getNextHighestDepth());<br />

myBitmapData.fillRect(new Rectangle(0, 0, 25, 80), 0x00FF0000);<br />

mc.onPress = function() {<br />

myBitmapData.scroll(25, 0);<br />

}<br />

setPixel (BitmapData.setPixel method)<br />

public setPixel(x:Number, y:Number, color:Number) : Void<br />

Sets the color of a single pixel of a BitmapData object. The current alpha channel value of the<br />

image pixel is preserved during this operation. The value of the RGB color parameter is<br />

treated as an unmultiplied color value.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 8<br />

Parameters<br />

x:Number - The x position of the pixel whose value changes.<br />

y:Number - The y position of the pixel whose value changes.<br />

color:Number - The RGB color to which to set the pixel.<br />

Example<br />

The following example uses the setPixel() method to assign a RGB value to a pixel at a<br />

specific x <strong>and</strong> y position. You can draw on the created bitmap in 0x000000 by dragging.<br />

import flash.display.BitmapData;<br />

var myBitmapData:BitmapData = new BitmapData(100, 80, false, 0x00CCCCCC);<br />

BitmapData (flash.display.BitmapData) 335

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!