Thursday, December 07, 2006

Seamless Background

Here is way to get seamless background for your websites or flex apps.




package{
public class SeamlessBackgroundTest extends Sprite
{
[Embed (source="../assets/scanline.png")]
private var Pattern:Class;
public function SeamlessBackgroundTest() {

super();
var pattern:Sprite=new Sprite();
this.addChild(pattern);

var bg:BitmapAsset=new Pattern() as BitmapAsset;
pattern.graphics.beginBitmapFill(b.bitmapData,
null,true,true);
pattern.graphics.moveTo(0,0);
pattern.graphics.lineTo(0,this.stage.stageHeight);

pattern.graphics.lineTo(this.stage.stageWidth,
this.stage.stageHeight);
pattern.graphics.lineTo(this.stage.stageWidth,0);
pattern.graphics.lineTo(0,0);
pattern.graphics.endFill();

}

}
}





No comments: