Topic: Centering a flash site with a SV Gallery embedded into it

Hi.

I did a search but can't seem to find this specific topic addressed.

I have a flash site that has a SV Gallery embedded in it.  When I publish the site, everything looks great (in Safari, at least--haven't tried any other browsers).  The only problem is that the whole site/movie is not centered either horizontally or vertically.  The gallery is where it should be in relation to the rest of the site, but the whole site movie is not positioned in the center.  Ideally, I would want it centered vertically and horizontally, and re-centering itself according to screen size and resizing of browser windows (in full screen mode too).  In short, I want my *site* to position itself the way the classic *gallery* included in the examples does.

I tried embedding my site with the html code used in classic.html, replacing simpleviewer.swf with the title of my swf, and the xml file with my xml file.  It publishes fine--with the SV gallery embedded and all--except for the positioning of the site.  When I switch the swf file back to simpleviewer.swf, it publishes centered--but draws from my xml, so essentially my gallery is there and looks great but it it sans the rest of my flash site.  I know this is not exactly an SV issue; SV is functioning as it should.  But I'm guessing at this point that the problem lies in my flash site's actionscript--that is, the actionscript that controls the larger site (as opposed to the one that calls the gallery)?  I am no flash expert, so any help would really be appreciated.

Thanks,

J

Re: Centering a flash site with a SV Gallery embedded into it

What is the URL of the gallery and please post the ActionScript you are using to embed SimpleViewer into your flash.

Mike Richards
SimpleViewer Support Team.

Re: Centering a flash site with a SV Gallery embedded into it

Hi.  Thanks for the response. 

The url: http://www.kidmages.com/kidmages_v1.html

This is the action script:

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

//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;   

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;
addChild(svLoader);
svLoader.contentLoaderInfo.addEventListener(Event.INIT, onViewerInit);
svLoader.load(new URLRequest("simpleviewer.swf"));

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


/**
* 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 = "gallery1.xml";
}

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


/**
* 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");
    svLoader.load(urlReq);
    swfLoaded = true;
}


function loadGallery1(e:Event){
    loadGallery("gallery1.xml");
}

function loadGallery2(e:Event){
    loadGallery("gallery2.xml");
}

Re: Centering a flash site with a SV Gallery embedded into it

Hi Fcjm,

If you change:

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;

to

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.CENTER;

your problem will be fixed i guess.

Nice artwork on your site btw !

Re: Centering a flash site with a SV Gallery embedded into it

hi,

SimpleViewer uses StageScaleMode.NO_SCALE and StageAlign.TOP_LEFT. When you embed SV-Pro it will override the stage properties of the container movie. Check the resize code in the 'examples/flash_embed/simpleviewer_flash_embed.fla' file in the Pro download to see how to handle resizing with these parameters set.

Felix Turner
SimpleViewer Support Team.

Re: Centering a flash site with a SV Gallery embedded into it

Felix wrote:

hi,

SimpleViewer uses StageScaleMode.NO_SCALE and StageAlign.TOP_LEFT. When you embed SV-Pro it will override the stage properties of the container movie. Check the resize code in the 'examples/flash_embed/simpleviewer_flash_embed.fla' file in the Pro download to see how to handle resizing with these parameters set.


What do you mean by this? I opened that file but all that actionscript isn't visible when i created a gallery. Why does the simpleviewer.swf doesn't come as an .fla so i can change settings?

Thanks in advance

Re: Centering a flash site with a SV Gallery embedded into it

The embed example FLA shows how to load SimpleViewer into a container movie. Check the AS in the example FLA for how to handle centering your movie with SV loaded. More details here: http://www.simpleviewer.net/simpleviewe … html#flash

Felix Turner
SimpleViewer Support Team.

Re: Centering a flash site with a SV Gallery embedded into it

Thanks for the heads up!

But what do i need to do if i want it to be in the center?

CHange this line of code?

stage.addEventListener(Event.RESIZE,onResize);
onResize(null);

Please understand that i'm a total geek on these matters. I bought your program for the simplicity. I managed to build a simple flash website but i don't understand what to do now. I could really use the help.

Someone has ideas?

Thanks in advance!

Last edited by Manggis (2010-07-16 21:37:26)