flash on 2009-7-31
/**
* Copyright yooKo_old_account ( http://wonderfl.net/user/yooKo_old_account )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/hMSu
*/
package {
import flash.display.Shape;
import flash.display.Sprite;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.display.GradientType;
import flash.display.Graphics;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var shape1:Shape = new Shape();
var w:int = 250;
var h:int=stage.stageHeight;
//線幅
//shape1.graphics.lineStyle(1);
//線状のグラデーション
var type:String = GradientType.LINEAR;
var colors:Array = [0x666666,0xFFFFFF];
var alphas:Array = [1, 0];
var ratios:Array = [0, 255];
var mtrx:Matrix = new Matrix();
mtrx.createGradientBox(w,h,0,0,0);
//グラデーションを45度回転する
//mtrx.rotate(Math.PI / 1);
var spread:String = "SpreadMethod.PAD";
var interpolation:String = "rgb";
var focalPointRatio:Number=0;
//グラデーションで塗る
shape1.graphics.beginGradientFill(type,colors,alphas,ratios,mtrx,spread,interpolation,focalPointRatio);
//四角形を描く
shape1.graphics.drawRect(0, 0, w, h);
shape1.graphics.endFill();
//ステージの中央に置く
//shape1.x = stage.stageWidth/2-w/2;
shape1.y = stage.stageHeight/2-h/2;
addChild(shape1);
}
}
}