flash on 2010-4-26

by 084
♥0 | Line 21 | Modified 2010-04-26 19:28:40 | MIT License
play

ActionScript3 source code

/**
 * Copyright 084 ( http://wonderfl.net/user/084 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/GmGH
 */

package {
import flash.display.GradientType;	
import flash.display.Sprite;
import flash.geom.Matrix;
	public class GradientFill extends Sprite {
		public function GradientFill() {
			init();
		}
		
		private function init():void {
			graphics.lineStyle(1);
			var colors:Array = [0xffff00,0x0000ff, 0xff0000];
			var alphas:Array = [1, 1,1];
			var ratios:Array = [0, 128,255];
			var matrix:Matrix = new Matrix();
			matrix.createGradientBox(100, 100, Math.PI/4, 100, 100);
			graphics.beginGradientFill(GradientType.RADIAL, colors, alphas, ratios, matrix);
			graphics.drawRect(100, 100, 100, 100);
			graphics.endFill();
		}
	}
}