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.

}<br />

var filter:DisplacementMapFilter = new DisplacementMapFilter(mapBitmap,<br />

new Point(-30, -30), 1, 1, 10, 10, "wrap", 0x000000, 0x000000);<br />

var txtBlock:MovieClip = createTextBlock();<br />

txtBlock._x = 30;<br />

txtBlock._y = 30;<br />

txtBlock.filters = new Array(filter);<br />

return txtBlock;<br />

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 />

scaleX (propriété DisplacementMapFilter.scaleX)<br />

public scaleX : Number<br />

Le multiplicateur à utiliser pour mettre à l'échelle le résultat <strong>du</strong> déplacement x à partir <strong>du</strong><br />

calcul <strong>de</strong> mappage.<br />

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

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

Saved successfully!

Ooh no, something went wrong!