Flex4中垂直渐变填充矩形

			var g:Graphics = this.graphics;
			
			g.clear();
			g.lineStyle(1, 0x000000);
			g.drawRect( 0, 0, unscaledWidth-1, unscaledHeight-1 );
			
			var fillType:String = GradientType.LINEAR;
			var colors:Array = [0x717171, 0xC0C0C0,0x717171];
			var alphas:Array = [1, 1,1];
			var ratios:Array = [0x32, 0x89, 0xFF];
			var matr:Matrix = new Matrix();
			
			matr.createGradientBox(unscaledWidth-3, unscaledHeight-3, Math.PI / 2, 0, 0);
			
			var spreadMethod:String = SpreadMethod.PAD;
			this.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr, spreadMethod);  
			g.drawRect( 1, 1, unscaledWidth-3, unscaledHeight-3 );
			g.endFill();

渐变效果:


你可能感兴趣的:(c,String,Flex,Matrix,colors)