How to center resizable flash content with gallery

Hi there…

I’m trying to center my flash site horizontally to be resizable using actions, but I have a SimpleViewer gallery to load at some point on the timeline inside a movieclip. Everything is working without the gallery on stage… but when I jump to the frame point where it is loaded… the center alignment is gone like the gallery is overwriting it or something…

The centering action in the first frame:

[COLOR=DarkRed]var myStage:Stage = this.stage;
myStage.scaleMode = StageScaleMode.NO_SCALE;
myStage.align = StageAlign.TOP;

function initialDisplay(event:Event):void{

var swfWidth:int = myStage.stageWidth;
var swfHeight:int = myStage.stageHeight;

var frameYPos:Number = swfHeight - frame.height;
var frameXPos:Number = swfWidth - frame.width;
var artgalXpos:Number = swfWidth - frame.width;

frame.y = frameYPos / 2;
frame.x = frameXPos / 2;

artgal.x = frameXPos / 2;

}

addEventListener(Event.ENTER_FRAME, initialDisplay);[/COLOR]

artgal - stands for the movieclip inctance name and its centering the gallery , but than the background and everything else stays in place :S

Inside the artgal movieclip I load the gallery with a simpleviewer.swf like this:
Maybe the problem is here? :S
[COLOR=DarkRed]
var svAPI:Object; //svAPI is the object to call API methods on
var svLoader:Loader = new Loader();
addChild(svLoader);
svLoader.contentLoaderInfo.addEventListener(Event.INIT, onViewerInit);
svLoader.load(new URLRequest(“simpleviewer.swf”));

function onViewerInit(e:Event):void{
var options:Object = Object(svLoader.content).embedOptions;
options.galleryURL = “gallery1.xml”;
}
/**

  • Fired when gallery has completely loaded. API is now available.
    */
    function onGalleryLoaded(e:Event):void{
    svAPI = Object(svLoader.content).api;
    svAPI.setSize(640,480);
    }
    [/COLOR]

So how can I make the first code to work there too where I have the gallery?
First Flash site attempt ever, so I’d love some help… ty :slight_smile: