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.

channelOptions:Number [facultatif] - Un nombre pouvant être une combinaison <strong>de</strong>s quatre<br />

valeurs <strong>de</strong> canaux <strong>de</strong> couleur : 1 (rouge), 2 (vert), 4 (bleu) et 8(alpha). Vous pouvez utiliser<br />

l'opérateur logique OR | pour combiner les valeurs <strong>de</strong> canaux. La valeur par défaut est (1 | 2<br />

| 4).<br />

grayScale:Boolean [facultatif] - Une valeur booléenne. Si la valeur est true, une image en<br />

nuances <strong>de</strong> gris est créée en définissant tous les canaux <strong>de</strong> couleur sur la même valeur. La<br />

sélection <strong>du</strong> canal alpha n'est pas affectée en définissant ce paramètre sur true. La valeur par<br />

défaut est false.<br />

Exemple<br />

L'exemple suivant indique comment appliquer un bruit pixel à un objet BitmapData pour un<br />

bitmap couleur et noir et blanc.<br />

import flash.display.BitmapData;<br />

import flash.geom.Rectangle;<br />

import flash.geom.Point;<br />

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

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

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

this.getNextHighestDepth());<br />

mc_1.attachBitmap(bitmapData_1, this.getNextHighestDepth());<br />

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

this.getNextHighestDepth());<br />

mc_2.attachBitmap(bitmapData_2, this.getNextHighestDepth());<br />

mc_2._x = 101;<br />

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

bitmapData_1.merge(bitmapData_2, new Rectangle(0, 0, 50, 40), new<br />

Point(25, 20), 128, 0, 0, 0);<br />

}<br />

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

bitmapData_1.noise(128, 0, 255, 1, true);<br />

}<br />

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

bitmapData_2.noise(128);<br />

}<br />

BitmapData (flash.display.BitmapData) 327

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

Saved successfully!

Ooh no, something went wrong!