Want to fill your flash stage area with a tiled image? You can fill your background with just a few lines of code.
First download the Image below (or use your own image) import to your library in flash. Right click on the image and select “properties” and click on “Export for ActionScript” under identifer type in “bg” then click “ok” to close the screen.
On the second frame on your flash file write or copy and pase the following code:
//Fill Background with a bitMap
import flash.display.BitmapData;
var tile:BitmapData = BitmapData.loadBitmap(“bg”);
this.beginBitmapFill(tile);
this.lineTo(0, 0);
this.lineTo(Stage.width, 0);
this.lineTo(Stage.width, Stage.height);
this.lineTo(0, Stage.height);
this.endFill();
stop();
I don’t know if it’s some kind of bug but you need to place your code on the second frame or you can loop the code to fill the stage with the tile background. I’ve Included a sample .fla to look at. it’s in CS3
You can download a sample .fla of this project.
Recent Comments