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.

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

Exemple<br />

L'exemple suivant montre comment définir la propriété colors sur une entité existante.<br />

import flash.filters.GradientBevelFilter;<br />

var mc:MovieClip = setUpFilter("colorsExample");<br />

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

var arr:Array = this.filters;<br />

var colors:Array = [0x000000, 0xCCCCCC, 0xFFFFFF];<br />

arr[0].colors = colors;<br />

this.filters = arr;<br />

}<br />

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

var arr:Array = this.filters;<br />

var colors:Array = [0xFFFFFF, 0xCCCCCC, 0x000000];<br />

arr[0].colors = colors;<br />

this.filters = arr;<br />

}<br />

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

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

this.getNextHighestDepth());<br />

var w:Number = 150;<br />

var h:Number = 150;<br />

art.beginFill(0xCCCCCC);<br />

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

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

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

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

}<br />

var colors:Array = [0xFFFFFF, 0xCCCCCC, 0x000000];<br />

var alphas:Array = [1, 0, 1];<br />

var ratios:Array = [0, 128, 255];<br />

var filter:GradientBevelFilter = new GradientBevelFilter(5, 225, colors,<br />

alphas, ratios, 5, 5, 5, 2, "inner", false);<br />

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

return art;<br />

Voir également<br />

alphas (propriété GradientBevelFilter.alphas), ratios (propriété<br />

GradientBevelFilter.ratios)<br />

GradientBevelFilter (flash.filters.GradientBevelFilter) 643

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

Saved successfully!

Ooh no, something went wrong!