Topic: Gallery keeps refreshing/reloading in Flash


I recently purchased simpleviewer pro and am working in a full flash website. The navigation is built with frame labels on the main timeline, and I'd prefer to not build the whole entire site structure over again if possible!

I have the main slideshow on the home page which seems to be working fine, just some resizing issues I can tweak, and then later on in my main timeline, the portfolio page contains a movie clip with a secondary navigation, where the mcLoader is located.

I copied the code from the flash_embed example and tweaked it accordingly (or so I think, as I am a newbie to AS3)

As I mentioned, the original slideshow works fine, but I have about 7 different sections that need individual galleries. Here is a link to the site: (Don't mind any layout issues, as I'm focusing on the gallery problem. … _NEW2.html

here is my code for the multiple galleries: I even left the comments in to guide me, but still can't fig. it out

//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){
function loadGallery3(e:Event){
function loadGallery4(e:Event){
function loadGallery5(e:Event){
function loadGallery6(e:Event){

Any help is greatly appreciated, I've been spending a day and a half on this!

Re: Gallery keeps refreshing/reloading in Flash

Just incase anyone else ever runs into this issue, I figured it out....

I had an extra frame in my movieclip that was causing the reload to happen. Everything works great now!