forked from: code on 2008-12-18
package{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.display.GradientType;
import flash.filters.DisplacementMapFilter;
import flash.events.Event;
import flash.geom.Point;
import flash.text.TextField;
import flash.text.TextFormat;
[SWF (width="465",height="465",backgroundColor="0x000000",frameRate="15")]
public class HelloFlag extends Sprite{
public function HelloFlag(){
var flag:Sprite = new Sprite();
flag.graphics.beginFill(0xffffff);
flag.graphics.drawRect(30,30,400,300);
addChild(flag);
var pole:Sprite = new Sprite();
pole.graphics.beginFill(0x999999);
pole.graphics.drawRect(30,30,10,400);
addChild(pole);
var tf:TextField = new TextField();
tf.text = "Hello World!!!";
tf.autoSize = "left";
tf.setTextFormat(new TextFormat("_self",48,0x000000));
tf.x = 30 + (400 - tf.width) / 2;
tf.y = 30 + (300 - tf.height) / 2;
tf.selectable = false;
flag.addChild(tf);
var bmpd:BitmapData = new BitmapData(flag.width,flag.height);
var v:Number = 0;
stage.addEventListener(Event.ENTER_FRAME,function():void{
bmpd.perlinNoise(bmpd.width,bmpd.height,2,5,false,true,7,false,[new Point(v,0),new Point(v,0)]);
flag.filters = [new DisplacementMapFilter(bmpd,new Point(0,0),1,1,30,30,"color")];
v += 100;
});
}
}
}