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.

function createGradientBitmap(w:Number, h:Number, bgColor:Number,<br />

type:String, hi<strong>de</strong>:Boolean):BitmapData {<br />

var mc:MovieClip = this.createEmptyMovieClip("mc", 1);<br />

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

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

}<br />

mc.beginGradientFill(type, [0xFF0000, 0x0000FF], [100, 100], [0x55,<br />

0x99], matrix, "pad");<br />

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

mc.lineTo(w, h);<br />

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

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

mc.endFill();<br />

(hi<strong>de</strong> == true) ? mc._alpha = 0 : mc._alpha = 100;<br />

var bmp:BitmapData = new BitmapData(w, h, true, bgColor);<br />

bmp.draw(mc, new Matrix(), new ColorTransform(), "normal",<br />

bmp.rectangle, true);<br />

mc.attachBitmap(bmp, this.getNextHighestDepth());<br />

return bmp;<br />

function createTextBlock():MovieClip {<br />

var txtBlock:MovieClip = this.createEmptyMovieClip("txtBlock",<br />

this.getNextHighestDepth());<br />

txtBlock.createTextField("txt", this.getNextHighestDepth(), 0, 0, 300,<br />

80);<br />

txtBlock.txt.text = "watch the text bend with the displacement map";<br />

return txtBlock;<br />

}<br />

mapBitmap (propriété<br />

DisplacementMapFilter.mapBitmap)<br />

public mapBitmap : BitmapData<br />

Un objet BitmapData contenant les données <strong>de</strong> mappage <strong>du</strong> déplacement.<br />

La propriété mapBitmap ne peut pas être changée en modifiant directement sa valeur. Vous<br />

<strong>de</strong>vez plutôt acquérir une référence à mapBitmap, effectuer le changement <strong>de</strong> référence et<br />

ensuite définir mapBitmap par rapport à la référence.<br />

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

DisplacementMapFilter (flash.filters.DisplacementMapFilter) 539

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

Saved successfully!

Ooh no, something went wrong!