Topic: SV shifting swf

I have looked through a lot of posts through this thread and have found nothing that mentions an answer to why SV shifts whatever SWF it's embedded in to the top left of the page.

Here is the AS3 code:

//import required classes
import flash.display.*;

//turn off stage auto resizing
//SimpleViewer requires these settings to function correctly
//scaling is handled via the onResize handler (see bottom of this code)
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;       

//Init variables
var svAPI:Object; //svAPI is the object to call API methods on
var swfLoaded:Boolean = false;
var galleryURL:String; //used when switching between galleries
var svLoader:Loader = new Loader(); //loader to load SimpleViewer swf into
var galleryShowing:Boolean = true;

//add svLoader to the "mcLoader" stage movieclip on the main timeline
//listen for SWF loaded
svLoader.contentLoaderInfo.addEventListener(Event.INIT, onViewerInit);
//load 1st gallery

* This function loads the SimpleViewer SWF
function loadGallery(url:String){
    galleryURL = url;
    //unload previous simpleviewer instance
    if (svAPI != null ) svAPI.dispose();
    svAPI = null;
    //flash 9 - unload
    if (swfLoaded) svLoader.unload();
    //Flash 10 - unloadAndStop
    //if (_viewerLoaded) svLoader.unloadAndStop();
    //load simpleviewer swf
    var urlReq:URLRequest = new URLRequest("simpleviewer.swf");
    swfLoaded = true;

* Fired when preloader is available
* Can set flashvars at this point
function onViewerInit(e:Event):void{
    //listen for
    Object(svLoader.content).addEventListener("svComplete", onGalleryLoaded);
    var options:Object = Object(svLoader.content).embedOptions;
     //set gallery.xml url based on current galleryId
    options.galleryURL = galleryURL;   
* Fired when gallery has completly loaded (SWF +  XML)
* API is now available.
function onGalleryLoaded(e:Event):void{
    svAPI = Object(svLoader.content).api;

//Init Button Click Handlers

//Button Click Handlers
function loadGallery1(e:Event){

function loadGallery2(e:Event){


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

    //resize mcFrame insude mcLoader
    mcLoader.mcFrame.width = stage.stageWidth - mcLoader.x - 20;
    mcLoader.mcFrame.height = stage.stageHeight - mcLoader.y - 20;
    //resize SV to match frame size
    if (svAPI != null ) svAPI.setSize(mcLoader.mcFrame.width,mcLoader.mcFrame.height);

Is there something I am missing here? I've tried changing (stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;) to different values but it still shifts to the left.

Any ideas?

Re: SV shifting swf


SimpleViewer uses StageScaleMode.NO_SCALE and StageAlign.TOP_LEFT. The shell movie's scale mode will be reset when SimpleViewer is loaded. Check the resize code in the example FLA to see how to handle resizing with these parameters set. … html#flash

Felix Turner
SimpleViewer Support Team.