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.

■ Ce co<strong>de</strong> <strong>de</strong>ssine l'image suivante à l'écran :<br />

spreadMethod:String [facultatif] - Ajouté à Flash Player 8. Soit « pad », « reflect » ou<br />

« repeat », ce qui contrôle le mo<strong>de</strong> <strong>du</strong> remplissage en dégradé. La valeur par défaut est « pad ».<br />

Par exemple, considérons un dégradé linéaire simple entre <strong>de</strong>ux couleurs :<br />

import flash.geom.*;<br />

var fillType:String = "linear"<br />

var colors:Array = [0xFF0000, 0x0000FF];<br />

var alphas:Array = [100, 100];<br />

var ratios:Array = [0x00, 0xFF];<br />

var matrix:Matrix = new Matrix();<br />

matrix.createGradientBox(20, 20, 0, 0, 0);<br />

var spreadMethod:String = "pad";<br />

this.beginGradientFill(fillType, colors, alphas, ratios, matrix,<br />

spreadMethod);<br />

this.moveTo(0, 0);<br />

this.lineTo(0, 100);<br />

this.lineTo(100, 100);<br />

this.lineTo(100, 0);<br />

this.lineTo(0, 0);<br />

this.endFill();<br />

Cet exemple utilise "pad" comme métho<strong>de</strong> d'étalement, et le remplissage en dégradé prend<br />

donc l'aspect suivant :<br />

MovieClip 865

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

Saved successfully!

Ooh no, something went wrong!