flash on 2009-10-20
/**
* Copyright dfrm ( http://wonderfl.net/user/dfrm )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/fFS6
*/
package {
import flash.display.Sprite;
import flash.display.BitmapDataChannel;
import flash.display.BitmapData;
import flash.display.Bitmap;
public class FlashTest extends Sprite {
private const WIDTH:Number = stage.stageWidth;
private const HEIGH:Number = stage.stageHeight;
private var barArray:Array;
private var barContainer:Sprite;
private var perlin:BitmapData;
public function FlashTest() {
// write as3 code here..
Init();
}
private function Init():void{
barArray = new Array();
barContainer = new Sprite();
perlin = new BitmapData(WIDTH,HEIGH);
var seed:Number = Math.floor(Math.random() * 10);
var channels:uint = BitmapDataChannel.RED | BitmapDataChannel.BLUE;
perlin.perlinNoise(100, 80, 6, seed, false, true, channels, false, null);
for(var i:int=0; i<30; i++){
barArray.push(new Sprite());
i%2 != 0 ? barArray[i].graphics.beginFill(0xff0000,1) : barArray[i].graphics.beginFill(0x0000ff,1);
barArray[i].graphics.drawRect(0,i*30,WIDTH,30);
barArray[i].graphics.endFill();
barContainer.addChild(barArray[i]);
}
addChild(barContainer);
addChild(new Bitmap(perlin)) as Bitmap;
}
}
}