I found these two codes online, the first code centers an object and sets a button to set full browser mode... and the second code that I found centers and object and tiles a background in full browser.

Now I tried to combine them so to achieve background tilling in full browser mode but the tiles will not cover the whole browser.

this is the full browser with background tiles code. I got the code from here:
http://www.gotoandlearn.com/player.php?id=31

Code:
import flash.display.BitmapData;

cover._x = Stage.width / 2;
cover._y = Stage.height / 2;

var tile:BitmapData = BitmapData.loadBitmap("tile");

function fillBG() {
	this.beginBitmapFill(tile);
	this.moveTo(0,0);
	this.lineTo(Stage.width,0);
	this.lineTo(Stage.width,Stage.height);
	this.lineTo(0,Stage.height);
	this.lineTo(0,0);
	this.endFill();
}

fillBG();

var stageL:Object = new Object();
stageL.onResize = function() {
	fillBG();
	cover._x = Stage.width / 2;
	cover._y = Stage.height / 2;
}

Stage.addListener(stageL);
///////////////////////////////////////////////////////////////////////////////////////////////////


And this is the full browser code. I got the code from here:
http://www.bezzmedia.com/swfspot/tut...een_Flash_Mode

Code:
   1.
      //Don't scale the movie when the stage size changes
   2.
      Stage.scaleMode="noScale";
   3.
      //Align the stage to the top left
   4.
      Stage.align = "TL";
   5.
      //Function to toggle between fullscreen and normal size
   6.
      //the toggle fullscreen button calls this function when pressed
   7.
      function toggleFullScreen(){
   8.
        //if normal size, go to fullscreen, else go to normal size
   9.
        if(Stage["displayState"]=="normal"){
  10.
          Stage["displayState"]="fullScreen";
  11.
        }else{
  12.
          Stage["displayState"]="normal";
  13.
        }
  14.
      }
  15.
      //Create a listener for each time the Stage is resized
  16.
      var resizeListener:Object = new Object();
  17.
      //Called each time the stage is resized
  18.
      resizeListener.onResize = function () {
  19.
        //Move the button to the center of the screen
  20.
        toggleFullScreenButton._x=Stage.width/2;
  21.
        toggleFullScreenButton._y=Stage.height/2;
  22.
      }
  23.
      //Add the listener to Stage
  24.
      Stage.addListener(resizeListener);
  25.
//////////////////////////////////////////////////////////////////////////////////////////

And this is the combination of the above two codes that didn't work for me.

Code:
//Don't scale the movie when the stage size changes
Stage.scaleMode="noScale";
//Align the stage to the top left
Stage.align = "TL";
//Function to toggle between fullscreen and normal size
//the toggle fullscreen button calls this function when pressed
function toggleFullScreen(){
	//if normal size, go to fullscreen, else go to normal size
	if(Stage["displayState"]=="normal"){
		Stage["displayState"]="fullScreen";
	}else{
		Stage["displayState"]="normal";
	}
}
//Create a listener for each time the Stage is resized
var resizeListener:Object = new Object();
//Called each time the stage is resized
resizeListener.onResize = function () {
	//Move the button to the center of the screen
	main_mc._x=Stage.width/2;
	main_mc._y=Stage.height/2;
}

import flash.display.BitmapData;

main_mc._x = Stage.width / 2;
main_mc._y = Stage.height / 2;

var tile:BitmapData = BitmapData.loadBitmap("tile");

function fillBG() {
	this.beginBitmapFill(tile);
	this.moveTo(0,0);
	this.lineTo(Stage.width,0);
	this.lineTo(Stage.width,Stage.height);
	this.lineTo(0,Stage.height);
	this.lineTo(0,0);
	this.endFill();
}

fillBG();

var stageL:Object = new Object();
stageL.onResize = function() {
	fillBG();
	main_mc._x = Stage.width / 2;
	main_mc._y = Stage.height / 2;
}

//Add the listener to Stage
Stage.addListener(resizeListener);
///////////////////////////////////////////////////////////////////////////////////////////

Anyone knows how I can combine these two cods effectively so that the background tile, covers the whole browser in full browser mode in all screen resolutions?

Thank you