topical media & game development
#graphic-flex-image-effects-02-Flex-GradientBevelFilterTest.ax
#graphic-flex-image-effects-02-Flex-GradientBevelFilterTest.ax
[swf]
[flash]
flex
package {
import flash.filters.BitmapFilterQuality;
import flash.filters.BitmapFilterType;
import flash.filters.GradientBevelFilter;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
[SWF(width=550, height=400, backgroundColor=0xEEEEEE)]
Tests application of the GradientFilter to a rectangle shape and a textfield.
public class @ax-graphic-flex-image-effects-02-Flex-GradientBevelFilterTest extends graphic_flex_image_effects_02_Flex_BitmapFilterTest {
Applies bitmap filter to rectangle shape and textfield.
override protected function applyFilter():void {
var filter:GradientBevelFilter = new GradientBevelFilter(60);
filter.colors = [0x0000FF, 0xFF00FF, 0x0000FF, 0x00FFFF, 0x0000FF];
filter.alphas = [0, 1, 0, 1, 0];
filter.ratios = [0, 24, 128, 232, 255];
filter.blurX = 15;
filter.blurY = 15;
filter.quality = BitmapFilterQuality.MEDIUM;
filter.type = BitmapFilterType.FULL;
filter.strength = 1;
filter.knockout = true;
_shape.filters = [filter];
_shape.alpha = .3;
// creates a textfield to which to apply the gradient
var field:TextField = new TextField();
var textFormat:TextFormat = new TextFormat("Arial", 36);
textFormat.align = TextFormatAlign.CENTER;
field.autoSize = TextFieldAutoSize.CENTER;
field.multiline = true;
field.defaultTextFormat = textFormat;
field.text = "Gradient\nBevel\nFilter";
field.x = _shape.x - field.width/2;
field.y = _shape.y - field.height/2;
filter.distance = 1;
filter.angle = 225;
filter.blurX = 2;
filter.blurY = 2;
field.filters = [filter];
addChild(field);
}
}
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.