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

Voir également<br />

BitmapData (flash.display.BitmapData)<br />

componentY (propriété<br />

DisplacementMapFilter.componentY)<br />

public componentY : Number<br />

Décrit le canal <strong>de</strong> couleur à utiliser dans l'image <strong>de</strong> mappage pour déplacer le résultat y. Les<br />

valeurs possibles sont 1 (rouge), 2 (vert), 4 (bleu) et 8 (alpha).<br />

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

Exemple<br />

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

utilisateur clique <strong>de</strong>ssus. La valeur passe <strong>de</strong> 1 à 4, ce qui change le canal <strong>de</strong> couleur <strong>de</strong> rouge à<br />

bleu.<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.componentY = 4;<br />

DisplacementMapFilter (flash.filters.DisplacementMapFilter) 535

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

Saved successfully!

Ooh no, something went wrong!