Posted By

weavermedia on 11/24/10


Tagged

as3


Versions (?)

Who likes this?

6 people have marked this snippet as a favorite

weavermedia
tspitzr
tombarc
scottwatkins
alidrongo
burnandbass


AS3 Drawing Circle with Radial Gradient


 / Published in: ActionScript 3
 

  1. // I can never remember how this goes, so here it is:
  2.  
  3. var circ:MovieClip = radialGradientCircle(50,true);
  4.  
  5. function radialGradientCircle(radius:Number, autoAdd:Boolean=true):MovieClip
  6. {
  7. var c:MovieClip = new MovieClip;
  8. var mtx:Matrix = new Matrix();
  9. mtx.createGradientBox(radius*2,radius*2,0,-radius,-radius);
  10. c.graphics.beginGradientFill(GradientType.RADIAL, [0xDDDDDD, 0xFF6F22], [1,1], [0,255], mtx);
  11. c.graphics.drawCircle(0,0,radius);
  12. if (autoAdd) {addChild(c)};
  13. return c;
  14. }

Report this snippet  

You need to login to post a comment.