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.

Si vous tentez <strong>de</strong> définir la propriété blendMo<strong>de</strong> sur une autre valeur, Flash Player la définit<br />

sur "normal".<br />

Toutefois, si vous définissez cette propriété sur un entier, Flash Player convertit cette valeur en<br />

une chaîne correspondante :<br />

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

mclip.blendMo<strong>de</strong> = 8;<br />

trace (mclip.blendMo<strong>de</strong>) // add<br />

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

Exemple<br />

L'exemple suivant crée <strong>de</strong>ux clips avec <strong>de</strong>s remplissages en dégradé et change le mo<strong>de</strong> <strong>de</strong><br />

fon<strong>du</strong> <strong>de</strong> celui au premier plan toutes les secon<strong>de</strong>s. Pour que le mo<strong>de</strong> <strong>de</strong> fon<strong>du</strong> "alpha"<br />

s'affiche avec un effet, le dégradé pour le clip mc2 comprend une plage <strong>de</strong> rapports alpha, et le<br />

mo<strong>de</strong> <strong>de</strong> fon<strong>du</strong> "layer" est appliqué au clip parent (this.blendMo<strong>de</strong>="layer").<br />

{<br />

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

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

this.blendMo<strong>de</strong>="layer";<br />

this.createTextField("blendLabel", this.getNextHighestDepth(), 50, 150,<br />

100, 100)<br />

fillClip(mc1, 0x00AA00, 0x22FFFF, 100, 100)<br />

fillClip(mc2, 0xFF0000, 0x2211FF, 100, 50)<br />

mc2._x = 33;<br />

mc2._y = 33;<br />

var blendMo<strong>de</strong>In<strong>de</strong>x = 0;<br />

setInterval(changeBlendMo<strong>de</strong>, 1000);<br />

function changeBlendMo<strong>de</strong>()<br />

{<br />

mc2.blendMo<strong>de</strong> = blendMo<strong>de</strong>In<strong>de</strong>x % 14 + 1 ;<br />

// values 1 - 14<br />

blendLabel.text = (blendMo<strong>de</strong>In<strong>de</strong>x% 14 + 1) + ": " + mc2.blendMo<strong>de</strong>;<br />

blendMo<strong>de</strong>In<strong>de</strong>x++;<br />

}<br />

function fillClip(mc:MovieClip, color1:Number, color2:Number,<br />

alpha1:Number, alpha2: Number)<br />

matrix = {a:100, b:0, c:0, d:0, e:100, f:0, g:50, h:20, i:1};<br />

mc.beginGradientFill("linear", [color1, color2], [alpha1, alpha2], [0,<br />

0xFF], matrix);<br />

mc.lineStyle(8,0x888888,100)<br />

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

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

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

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

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

Saved successfully!

Ooh no, something went wrong!