topical media & game development
#graphic-flex-image-effects-02-Flex-GradientGlowFilterTest.ax
#graphic-flex-image-effects-02-Flex-GradientGlowFilterTest.ax
[swf]
[flash]
flex
package {
import flash.filters.BitmapFilterQuality;
import flash.filters.BitmapFilterType;
import flash.filters.GradientGlowFilter;
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 GradientGlowFilter to a rectangle shape and a textfield.
public class @ax-graphic-flex-image-effects-02-Flex-GradientGlowFilterTest extends graphic_flex_image_effects_02_Flex_BitmapFilterTest {
Applies bitmap filter to rectangle shape and textfield.
override protected function applyFilter():void {
var filter:GradientGlowFilter = new GradientGlowFilter();
filter.distance = 0;
filter.colors = [0xCC88FF, 0xCC88FF, 0x663399, 0x006666];
filter.alphas = [0, .6, .9, 1];
filter.ratios = [0, 50, 100, 255];
filter.type = BitmapFilterType.FULL;
filter.blurX = 2;
filter.blurY = 2;
filter.quality = BitmapFilterQuality.MEDIUM;
filter.knockout = true;
_shape.filters = [filter];
// creates textfield to which to apply the gradient glow
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\nGlow\nFilter";
field.x = _shape.x - field.width/2;
field.y = _shape.y - field.height/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.