flash - AS3: beginGradientFIll() doesn't make me a gradient! -


i'm trying render circle radial gradient can't seem figure out.

var bkgdgrad:shape = new shape(); bkgdgrad.graphics.begingradientfill(gradienttype.radial, [0x0000ff, 0x00ff00], [1, 1], [0, 255],null,"pad"); bkgdgrad.graphics.drawcircle(0,0,r+200); bkgdgrad.graphics.endfill(); this.addchild(bkgdgrad); 

the above code renders solid green circle me. if change array after colors [1,0] (the alpha array) transparent fill. can't seem flash draw radial gradient, above works no problem gradienttype.linear

try this, may you:

package   {       import flash.display.sprite;       import flash.display.gradienttype;       import flash.geom.matrix;        public class radialgradient extends sprite       {           private var gtype:string;           private var matrix:matrix;            private var bound:sprite;            public function radialgradient()           {               var gtype:string = gradienttype.radial;                var matrix:matrix = new matrix();               matrix.creategradientbox(550,400,0,0,0);                var gcolors:array = [0x0000ff, 0x00ff00];               var galphas:array = [1,1];               var gratio:array = [0,255];                var bound:sprite = new sprite();               bound.graphics.begingradientfill(gtype,gcolors,galphas,gratio,matrix);               bound.graphics.drawcircle(0,0,r+200);             bound.x = bound.y = 0;               addchild(bound);           }       }   }   

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -