Centering an mc

hey guys,

here’s the deal, I have a main swf named index.swf with only 1 frame, on that frame I have actionscript that creates an empty movieclip loads an external swf and centers it depending on the user’s browser size.

My problem is if I load an swf that doesn’t take the whole 1020x610 of the index.swf it won’t be centered. It’s kind of hard to explain. so here’s some of the code.


this.createEmptyMovieClip("container",this.getNextHighestDepth());

container.loadMovie("../swf/splash.swf");

var stageXCenter:Number = Stage.width * .5;
var stageYCenter:Number = Stage.height * .5;

stageXCenter = stageXCenter  - (container._width * .5);
stageYCenter = stageYCenter  - (container._height * .5);

container._x = stageXCenter;
container._y = stageYCenter;

stageListener = new Object();

stageListener.onResize = function():Void {
    stageXCenter = Stage.width * .5;
    stageYCenter = Stage.height * .5;
        
    stageXCenter = stageXCenter  - (container._width * .5);
    stageYCenter = stageYCenter  - (container._height * .5);

    container._x = stageXCenter;
    container._y = stageYCenter;
}

Stage.addListener(stageListener);

Any help would be greatly appreciated