Help with scaling and borders with a tiled bg

i hope some one can help i created a flash document and then added a tiled background to the atage using this code
import flash.display.BitmapData;
var tile:BitmapData = BitmapData.loadBitmap(“kpattern2”);
this.lineTo(Stage.width, 0);
this.lineTo(Stage.width, Stage.height);
this.lineTo(0, Stage.height);
this.lineTo(0, 0);

but i am unable to place a border around the stage and unable to place the satge in the centre of the page when viewed in the browser can anyone help please