03.07.2013 Views

Guide de reference du langage ActionScript 2.0 - PowWeb

Guide de reference du langage ActionScript 2.0 - PowWeb

Guide de reference du langage ActionScript 2.0 - PowWeb

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

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

this.getNextHighestDepth());<br />

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

var alpha:String = (myBitmapData.getPixel32(0, 0) >> 24 &<br />

0xFF).toString(16);<br />

trace(">> alpha: " + alpha); // ff<br />

var red:String = (myBitmapData.getPixel32(0, 0) >> 16 & 0xFF).toString(16);<br />

trace(">> red: " + red); // aa<br />

var green:String = (myBitmapData.getPixel32(0, 0) >> 8 &<br />

0xFF).toString(16);<br />

trace(">> green: " + green); // cc<br />

var blue:String = (myBitmapData.getPixel32(0, 0) & 0xFF).toString(16);<br />

trace(">> blue: " + blue); // ee<br />

trace("0x" + alpha + red + green + blue); // 0xffaaccee<br />

Voir également<br />

getPixel (métho<strong>de</strong> BitmapData.getPixel)<br />

height (propriété BitmapData.height)<br />

public height : Number [lecture seule]<br />

La hauteur <strong>de</strong> l'image bitmap en pixels.<br />

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

Exemple<br />

L'exemple suivant montre que la propriété height <strong>de</strong> l'occurrence BitmapData est en lecture<br />

seule car il essaie <strong>de</strong> la définir mais échoue :<br />

import flash.display.BitmapData;<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 />

trace(myBitmapData.height); // 80<br />

myBitmapData.height = 999;<br />

trace(myBitmapData.height); // 80<br />

322 Chapitre 2: Classes <strong>ActionScript</strong>

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

Saved successfully!

Ooh no, something went wrong!