Works in Flash, not in Browser?!?!?

So this is a new one to me. I have developed this code:

[AS]var myListener:Object = new Object();
myListener.onResize = function() {
//
var NewH:Number;
var NewW:Number;
NewH = Stage.height;
NewW = Stage.width;
//
trace("W = "+NewW);
trace("H = "+NewH);

if (Stage.width/800>Stage.height/600) {
ground._width = NewW;
ground._height = ground._width*0.75;
}

if (Stage.width/800<Stage.height/600) {
ground._height = NewH;
ground._width = ground._height*1.333;
}

};
Stage.addListener(myListener);

myListener.onResize();[/AS]

And it works GREAT to resize my backround image to fill the movie as it gets resized, that is until i export it and try to view it online (or preview it in dreamweaver before uploading). The culprit appears to be the resizing section of code:

if (Stage.width/800>Stage.height/600) {
	ground._width = NewW;
	ground._height = ground._width*0.75;
	}
	
	if (Stage.width/800<Stage.height/600) {
	ground._height = NewH;
	ground._width = ground._height*1.333;
	}

Any insight would be greatly appreciated!