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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

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

public scaleY : Number<br />

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

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

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

Exemple<br />

L'exemple suivant change la propriété scaleY sur le clip existant filteredMc quand un<br />

utilisateur clique <strong>de</strong>ssus.<br />

import flash.filters.DisplacementMapFilter;<br />

import flash.display.BitmapData;<br />

import flash.geom.Point;<br />

import flash.geom.Matrix;<br />

import flash.geom.ColorTransform;<br />

var filteredMc:MovieClip = createDisplacementMapRectangle();<br />

filteredMc.onPress = function() {<br />

var filter:DisplacementMapFilter = this.filters[0];<br />

filter.scaleY = 5;<br />

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

}<br />

function createDisplacementMapRectangle():MovieClip {<br />

var mapBitmap:BitmapData = createGradientBitmap(300, 80, 0xFF000000,<br />

"radial");<br />

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

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

Saved successfully!

Ooh no, something went wrong!