views:

96

answers:

2

how do you make a tiled background in actionscript 3? Ive been entering codes i found around the internet, but it seems to be messing up my slideshow pro.... so i want to try some other views

+1  A: 

Load the bitmap, draw it onto a shape using bitmap fill and add the shape to the bottom of the display list.

public function applyTiledBkg(imgURL:String):void
{
    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoad);
    //listen to the ioError and other events of the loader here
    loader.load(new URLRequest(imgURL));
}
public function onLoad(e:Event):void
{
    var bmpData:BitmapData = Bitmap(LoaderInfo(e.target).content).bitmapData;
    var bkg:Shape = new Shape();
    bkg.graphics.beginBitmapFill(bmpData);
    bkg.graphics.drawRect(0, 0, bkgWidth, bkgHeight);
    addChildAt(bkg, 0);
}
Amarghosh
A: 

You may have a look at Seamless Vector Texture form actionsnippet.com.

Andy Li