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.

var mc:MovieClip = createGlowFilterRectangle("GlowFilterAlpha");<br />

mc.onRelease = function() {<br />

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

filter.alpha = .4;<br />

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

}<br />

function createGlowFilterRectangle(name:String):MovieClip {<br />

var rect:MovieClip = this.createEmptyMovieClip(name,<br />

this.getNextHighestDepth());<br />

var w:Number = 100;<br />

var h:Number = 100;<br />

rect.beginFill(0x003366);<br />

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

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

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

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

rect._x = 20;<br />

rect._y = 20;<br />

}<br />

var filter:GlowFilter = new GlowFilter(0x000000, .8, 16, 16, 1, 3, false,<br />

false);<br />

var filterArray:Array = new Array();<br />

filterArray.push(filter);<br />

rect.filters = filterArray;<br />

return rect;<br />

blurX (propriété GlowFilter.blurX)<br />

public blurX : nombre<br />

Le niveau <strong>de</strong> flou horizontal. Les valeurs vali<strong>de</strong>s sont comprises entre 0 et 255 (virgule<br />

flottante). La valeur par défaut est 6. Les valeurs correspondant à une puissance <strong>de</strong> 2 (2, 4, 8,<br />

16 et 32) sont optimisées pour obtenir un ren<strong>du</strong> plus rapi<strong>de</strong> qu'avec les autres valeurs.<br />

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

Exemple<br />

L'exemple suivant modifie la propriété blurX sur un clip existant lorsqu'un utilisateur clique<br />

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

import flash.filters.GlowFilter;<br />

var mc:MovieClip = createGlowFilterRectangle("GlowFilterBlurX");<br />

mc.onRelease = function() {<br />

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

filter.blurX = 20;<br />

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

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

Saved successfully!

Ooh no, something went wrong!