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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Exemple<br />

L'exemple suivant utilise la métho<strong>de</strong> getPixel() pour récupérer la valeur RVB d'un pixel à<br />

un emplacement x et y spécifique.<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("0x" + myBitmapData.getPixel(0, 0).toString(16)); // 0xcccccc<br />

Voir également<br />

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

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

public getPixel32(x:Number, y:Number) : Number<br />

Renvoie une valeur <strong>de</strong> couleur ARVB qui contient <strong>de</strong>s données <strong>de</strong> canal alpha, ainsi que les<br />

données RVB. Cette métho<strong>de</strong> est similaire à la métho<strong>de</strong> getPixel() qui renvoie une couleur<br />

RVB sans les données <strong>de</strong> canal alpha.<br />

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

Paramètres<br />

x:Number - La coordonnée x <strong>du</strong> pixel.<br />

y:Number - La coordonnée y <strong>du</strong> pixel.<br />

Renvoie<br />

Number - Un nombre représentant une valeur <strong>de</strong> pixels ARVB. Si les coordonnées (x, y) se<br />

trouvent à l'extérieur <strong>de</strong>s limites <strong>de</strong> l'image, la valeur 0 est renvoyée. Si le bitmap créé est<br />

opaque et non transparent, cette métho<strong>de</strong> renvoie alors un co<strong>de</strong> d'erreur <strong>de</strong> -1.<br />

Exemple<br />

L'exemple suivant utilise la métho<strong>de</strong> getPixel32() pour récupérer la valeur ARVB d'un pixel<br />

à un emplacement x et y spécifique :<br />

import flash.display.BitmapData;<br />

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

BitmapData (flash.display.BitmapData) 321

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

Saved successfully!

Ooh no, something went wrong!