topical media & game development

talk show tell print

animation-ch04-GradientFill.ax

animation-ch04-GradientFill.ax [swf] [flash] flex


  package
  {
   import flash.display.GradientType;
   import flash.display.Sprite;
   import flash.events.MouseEvent;
   import flash.geom.Matrix;
   
   public class @ax-animation-ch04-GradientFill extends Sprite
   {
    public function @ax-animation-ch04-GradientFill()
    {
     init();
    }
   

init(s)


    private function init():void
    {
     graphics.lineStyle(1);
     var colors:Array = [0xffffff, 0xff0000];
     var alphas:Array = [1, 1];
     var ratios:Array = [0, 255];
     var matrix:Matrix = new Matrix();
     matrix.createGradientBox(100, 100, 0, 0, 0);
     graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
     graphics.drawRect(100, 100, 100, 100);
     graphics.endFill();
    }
   }
  }
  


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