Topic: Center a gallery on Flash

Please help, i've follow Felix's advice to review the FLA included in the examples but still cant figure out how to make the gallery appear in the center of the screen

this is how far i've gotten with the code.


/**
* Fired when preloader is available
* Can set gallery flashvars at this point
*/
function onViewerInit(e:Event):void{
Object(svLoader.content).addEventListener("svComplete", onGalleryLoaded);
var options:Object = Object(svLoader.content).embedOptions;
options.galleryURL = "gallery-mtk.xml";
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
//add svLoader to the "mcLoader" stage movieclip on the main timeline
mcLoader.addChild(svLoader);
//listen for SWF loaded
svLoader.contentLoaderInfo.addEventListener(Event.INIT, onViewerInit);
function resizeHandler(e:Event):void
{
  svLoader.x = (svLoader.stage.stageWidth / 2) - (svLoader.width / 2);
  svLoader.y = (svLoader.stage.stageHeight / 2) - (svLoader.height / 2);
}}

//example resizing code
stage.addEventListener(Event.RESIZE,onResize);
onResize(null);

//called on stage resize
function onResize(e:Event){   
    //strecth bkgnd to match stage dimensions
    MC.width = stage.stageWidth;
    MC.height = stage.stageHeight;
   
    //resize mcLoader
    mcLoader.width = stage.stageWidth;
    mcLoader.height = stage.stageHeight;
   
   
}


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




OR this one


* Fired when preloader is available
* Can set gallery flashvars at this point
*/
function onViewerInit(e:Event):void{
Object(svLoader.content).addEventListener("svComplete", onGalleryLoaded);
var options:Object = Object(svLoader.content).embedOptions;
options.galleryURL = "gallery-mtk.xml";
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;

function resizeHandler(e:Event):void
{
  mcLoader.x = (mcLoader.stage.stageWidth / 2) - (mcLoader.width / 2);
  mcLoader.y = (mcLoader.stage.stageHeight / 2) - (mcLoader.height / 2);
}
}
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE,onResize);

stage.dispatchEvent(new Event(Event.RESIZE));



//example resizing code
stage.addEventListener(Event.RESIZE,onResize);
onResize(null);

//called on stage resize
function onResize(e:Event){   
   
   
    //resize mcFrame insude mcLoader
    mcLoader.width = 800;
    mcLoader.height = 600;
   
    //resize SV to match frame size
    if (svAPI != null ) svAPI.setSize(mcLoader.MC.width,mcLoader.MC.height);
   
}


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


Please HELP

Re: Center a gallery on Flash

I'm actually working on this exact thing right now - building an XHTML 1.0 compliant website.

Using CSS, I'm defining the width of the screen I'm using for the entire page:

body {width: 975px; margin-left: auto; margin-right: auto;}

Then using a container:

.container {width: 950px; margin-top: 25px;}


Then when you grab the HTML for the flash  simpleviewer player (you've set the max width to 900 pixels wide?), you simply set it within the container:

<div class="container">

(insert HTML for the flash viewer here)

</div>

I'm going to be going over it line by line to try to make sure it's XHTML 1.0 compliant at all levels, so I can use it in my class.

Hope this helps.