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.

Exemple<br />

Le co<strong>de</strong> suivant définit un bitmap unique, puis utilise beginBitmapFill() pour remplir un<br />

clip en formant une mosaïque.<br />

import flash.display.*;<br />

import flash.geom.*;<br />

var bmpd:BitmapData = new BitmapData(20,20);<br />

var rect1:Rectangle = new Rectangle(0,0,10,10);<br />

var rect2:Rectangle = new Rectangle(0, 10, 10, 20);<br />

var rect3:Rectangle = new Rectangle(10, 0, 20, 10);<br />

var rect4:Rectangle = new Rectangle(10, 10, 20, 20);<br />

bmpd.fillRect(rect1, 0xAA0000FF);<br />

bmpd.fillRect(rect2, 0xAA00FF00);<br />

bmpd.fillRect(rect3, 0xAAFF0000);<br />

bmpd.fillRect(rect4, 0xAA999999);<br />

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

with (bmp_fill_mc) {<br />

matrix = new Matrix();<br />

matrix.rotate(Math.PI/8);<br />

repeat = true;<br />

smoothing = true;<br />

beginBitmapFill(bmpd, matrix, repeat, smoothing);<br />

moveTo(0, 0);<br />

lineTo(0, 60);<br />

lineTo(60, 60);<br />

lineTo(60, 0);<br />

lineTo(0, 0);<br />

endFill();<br />

}<br />

bmp_fill_mc._xscale = 200;<br />

bmp_fill_mc._yscale = 200;<br />

Si votre fichier SWF comprend un composant <strong>de</strong> la version 2, utilisez les composants <strong>de</strong> la<br />

version 2 <strong>de</strong> la classe DepthManager au lieu <strong>de</strong> la métho<strong>de</strong><br />

MovieClip.getNextHighestDepth(), utilisée dans cet exemple.<br />

beginFill (métho<strong>de</strong> MovieClip.beginFill)<br />

public beginFill(rgb:Number, [alpha:Number]) : Void<br />

Indique le début d'un nouveau chemin <strong>de</strong> <strong>de</strong>ssin. Si un tracé ouvert existe (autrement dit, si la<br />

position <strong>de</strong> <strong>de</strong>ssin actuelle n'est pas égale à la position précé<strong>de</strong>nte spécifiée dans une métho<strong>de</strong><br />

MovieClip.moveTo()) et qu'un remplissage y est associé, ce tracé est fermé à l'ai<strong>de</strong> d'une<br />

ligne, puis rempli. Cette métho<strong>de</strong> pro<strong>du</strong>it les mêmes effets que lorsqu'une métho<strong>de</strong><br />

MovieClip.endFill() est appelée.<br />

MovieClip 859

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

Saved successfully!

Ooh no, something went wrong!