topical media & game development

talk show tell print

#graphic-flex-image-effects-02-Flex-BevelFilterTest.ax

#graphic-flex-image-effects-02-Flex-BevelFilterTest.ax [swf] [flash] flex


  package {
  
          import flash.display.Shape;
          import flash.filters.BevelFilter;
  
          [SWF(width=550, height=400, backgroundColor=0xEEEEEE)]
  
          
Tests application of the BevelFilter to two rectangle shapes.

  
          public class @ax-graphic-flex-image-effects-02-Flex-BevelFilterTest extends graphic_flex_image_effects_02_Flex_BitmapFilterTest {
  
                  
Applies bitmap filter to rectangle shape and textfield.

  
                  override protected function applyFilter():void {
                          var filter:BevelFilter = new BevelFilter(10);
                          filter.highlightAlpha = .5;
                          filter.shadowAlpha = .5;
                          filter.blurX = 15;
                          filter.blurY = 15;
                          filter.strength = 80;
                          _shape.filters = [filter];
  
                          // draws second shape to inset within outer rectangle
                          var shape:Shape = new Shape();
                          shape.graphics.beginFill(0x004444);
                          shape.graphics.drawRect(-50, -50, 100, 100);
                          shape.graphics.endFill();
                          shape.x = stage.stageWidth/2;
                          shape.y = stage.stageHeight/2;
  
                          // reverses the light direction, making the shape appear inset
                          filter.distance = 5;
                          filter.angle = 225;
                          filter.strength = 1;
                          shape.filters = [filter];
                          addChild(shape);
                  }
  
          }
  
  }
  


(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.