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.

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

■ Un objet avec les propriétés suivantes : matrixType, x, y, w, h, r.<br />

■ Les propriétés ont la signification suivante : matrixType correspond à la chaîne "box", x<br />

désigne la position horizontale par rapport au point d'alignement <strong>du</strong> clip parent pour le<br />

coin supérieur gauche <strong>du</strong> dégradé, y indique la position verticale par rapport au point<br />

d'alignement <strong>du</strong> clip parent pour le coin supérieur gauche <strong>du</strong> dégradé, w correspond à la<br />

largeur <strong>du</strong> dégradé, h à sa hauteur, et r indique la rotation en radians <strong>du</strong> dégradé.<br />

■ Remarque : A partir <strong>de</strong> Flash Player 8, Macromedia recomman<strong>de</strong> <strong>de</strong> définir le paramètre<br />

matrix sous la forme d'un objet flash.geom.Matrix (comme indiqué dans le premier<br />

élément <strong>de</strong> cette liste).<br />

■ L'exemple suivant utilise la métho<strong>de</strong> beginGradientFill() avec un paramètre matrix<br />

<strong>du</strong> type suivant :<br />

this.createEmptyMovieClip("gradient_mc", this.getNextHighestDepth());<br />

with (gradient_mc)<br />

{<br />

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

fillType = "radial"<br />

alphas = [100, 100];<br />

ratios = [0, 0xFF];<br />

spreadMethod = "reflect";<br />

interpolationMethod = "linearRGB";<br />

focalPointRatio = 0.9;<br />

matrix = {matrixType:"box", x:100, y:100, w:200, h:200, r:(45/<br />

180)*Math.PI};<br />

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

spreadMethod, interpolationMethod, focalPointRatio);<br />

moveTo(100, 100);<br />

lineTo(100, 300);<br />

lineTo(300, 300);<br />

lineTo(300, 100);<br />

lineTo(100, 100);<br />

endFill();<br />

}<br />

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

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

Saved successfully!

Ooh no, something went wrong!