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.

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

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

Effectue une opération <strong>de</strong> peinture sur une image à partir <strong>de</strong> certaines coordonnées (x, y) et à<br />

l'ai<strong>de</strong> d'une certaine couleur. La métho<strong>de</strong> floodFill() est similaire à l'outil Pot <strong>de</strong> peinture<br />

dans divers programmes <strong>de</strong> <strong>de</strong>ssin. La couleur ARVB contient <strong>de</strong>s informations alpha ainsi<br />

que <strong>de</strong>s informations sur les couleurs.<br />

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

Paramètres<br />

x:Number - La coordonnée x <strong>de</strong> l'image.<br />

y:Number - La coordonnée y <strong>de</strong> l'image.<br />

color:Number - La couleur ARVB à utiliser pour le remplissage. Les couleurs ARVB sont<br />

souvent spécifiées au format hexadécimal, tel que 0xFF336699.<br />

Exemple<br />

L'exemple suivant indique comment appliquer une couleur <strong>de</strong> peinture à une image à partir<br />

<strong>du</strong> point sur lequel l'utilisateur clique sur le bouton <strong>de</strong> la souris au sein d'un objet<br />

BitmapData.<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, 50, 40), 0x00FF0000);<br />

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

myBitmapData.floodFill(_xmouse, _ymouse, 0x000000FF);<br />

}<br />

BitmapData (flash.display.BitmapData) 317

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

Saved successfully!

Ooh no, something went wrong!