topical media & game development

talk show tell print

lib-flex-animation-code-09-ShaderFillEmbed.ax

lib-flex-animation-code-09-ShaderFillEmbed.ax (swf ) [ flash ] flex


  package {
          import flash.display.Shader;
          import flash.display.Sprite;
          import flash.display.StageAlign;
          import flash.display.StageScaleMode;
          import flash.geom.Matrix;
  
          public class @ax-lib-flex-animation-code-09-ShaderFillEmbed extends Sprite
          {
                  [Embed (source="Checkerboard.pbj", 
                          mimeType="application/octet-stream")]
                  private var ShaderClass:Class;
                  
                  public function @ax-lib-flex-animation-code-09-ShaderFillEmbed()
                  {
                          stage.align = StageAlign.TOP_LEFT;
                          stage.scaleMode = StageScaleMode.NO_SCALE;
                          
                          var shader:Shader = new Shader(new ShaderClass());
                  
                          var angle:Number = Math.PI / 4;
                          var cos:Number = Math.cos(angle);
                          var sin:Number = Math.sin(angle);
                          graphics.beginShaderFill(shader, new Matrix(cos, sin, -sin, cos));
                          graphics.drawRect(20, 20, 400, 400);
                          graphics.endFill();
                  }
          }
  }
  


(C) Æliens 18/6/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.