package { import flash.display.Shape; import flash.display.Sprite; /** * Astract class for testing application of BitmapFilters to a rectangle shape. */ public class graphic_flex_image_effects_02_Flex_BitmapFilterTest extends Sprite { protected var _shape:Shape; /** * Constructor. */ public function graphic_flex_image_effects_02_Flex_BitmapFilterTest() { createShape(); applyFilter(); } /** * Creates a rectangle shape with a solid fill in the center of the stage. */ private function createShape():void { var sideWidth:Number = 150; _shape = new Shape(); _shape.graphics.beginFill(0x006666); _shape.graphics.drawRect(-sideWidth/2, -sideWidth/2, sideWidth, sideWidth); _shape.graphics.endFill(); _shape.x = stage.stageWidth/2; _shape.y = stage.stageHeight/2; addChild(_shape); } /** * Abstract method to be overridden by child classes in order to apply * a bitmap filter to the drawn shape. */ protected function applyFilter():void {} } }