Mega Code Archive

 
Categories / Flash ActionScript / Graphics
 

Applying Gradient Fills

package{   import flash.display.*;   import flash.geom.*;   public class Main extends Sprite{     public function Main(){         var shape: Shape = new Shape ();         shape.x = 100;         shape.y = 100;                  var mxBox:Matrix = new Matrix();         mxBox.createGradientBox(200, 200);                  shape.graphics.lineStyle(10);                  shape.graphics.beginGradientFill("radial", [0xFFFF00, 0x00FFFF],           [100, 100], [0x00, 0xFF], mxBox, "reflect", "RGB", 1);         shape.graphics.curveTo(200, -100, 400, 0);         shape.graphics.lineTo(400, 200);         shape.graphics.lineTo(0, 200);         shape.graphics.lineTo(0, 0);         shape.graphics.endFill();     }   } }