2 Replies Latest reply on Sep 13, 2006 11:09 PM by Bora Imamoglu

    Gradient Fills?

    leotemp Level 1
      Right now im using graphics to acomplish my gradients but how do i create a gradient for say a canvas? i see the application supports two fill colors but when i try use that for a canvas i get errors..
        • 1. Re: Gradient Fills?
          leotemp Level 1
          been about 3 months since i posted this, any way to have a gradient fill for a component other then the application?
          • 2. Re: Gradient Fills?
            Bora Imamoglu
            Hope this helps;

            import flash.geom.*
            import flash.display.*
            var fillType:String = GradientType.LINEAR;
            var colors:Array = [0xFF0000, 0x0000FF];
            var alphas:Array = [100, 100];
            var ratios:Array = [0x00, 0xFF];
            var matr:Matrix = new Matrix();
            matr.createGradientBox(20, 20, 0, 0, 0);
            var spreadMethod:String = SpreadMethod.PAD;
            this.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr, spreadMethod);

            You can find more info on gradients here.