Re: embed multiple galleries in flash CS5

Hi Steve,

I guess everything is working. I still have text stacking on top of each other when loading different galleries. I use a background image to cover it, so it doesn't bother me. Thank you for helping me. Actionscript is a tough nut if u begin from scratch.
Thanks again

greets from amsterdam
joost

for flash users using multiple galleries...this is my work around:

create frame labels on the timeline for each gallery. Create buttons to play the frame label

on the beginning of the frame label (of you're 1st gallery) create this AS code:

stop();

import flash.display.*;
import flash.net.URLRequest;

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

var svAPI:Object;
var swfLoaded:Boolean = false;
var galleryURL:String;
var svLoaderHome:Loader = new Loader();
var galleryShowing:Boolean = true;

mcLoader.addChild(svLoaderHome);
svLoaderHome.contentLoaderInfo.addEventListener(Event.INIT, onViewerInitHome);
loadGalleryHome("gallery/home/");

function loadGalleryHome(url:String){

    if (svAPI != null ) svAPI.dispose();
    svAPI = null;
    var urlReq:URLRequest = new URLRequest("simpleviewer.swf");
    svLoaderHome.load(urlReq);
    swfLoaded = true;
}

function onViewerInitHome(e:Event):void{
Object(svLoaderHome.content).addEventListener("svComplete", onGalleryLoadedHome);
var options:Object = Object(svLoaderHome.content).embedOptions;
options.baseURL = "gallery/home/";
}

function onGalleryLoadedHome(e:Event):void{
    mcLoader.mcFrame.width = 1204
    mcLoader.mcFrame.height = 667
    mcLoader.mcFrame.width = stage.stageWidth - mcLoader.x - 300;
    mcLoader.mcFrame.height = stage.stageHeight - mcLoader.y - 200;
    svAPI = Object(svLoaderHome.content).api;
    svAPI.setSize(mcLoader.mcFrame.width,mcLoader.mcFrame.height);
}

then on your the frame label of you're next gallery use:


stop();

import flash.display.*;
import flash.net.URLRequest;

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

var svLoader1:Loader = new Loader();

mcLoader.addChild(svLoader1);
svLoader1.contentLoaderInfo.addEventListener(Event.INIT, onViewerInit1);
loadGallery1("gallery/events/");

function loadGallery1(url:String){
    galleryURL = url;
    if (svAPI != null ) svAPI.dispose();
    svAPI = null;
    if (swfLoaded) svLoader1.unload();
    var urlReq:URLRequest = new URLRequest("simpleviewer.swf");
    svLoader1.load(urlReq);
    swfLoaded = true;
}

function onViewerInit1(e:Event):void{
Object(svLoader1.content).addEventListener("svComplete", onGalleryLoaded1);
var options:Object = Object(svLoader1.content).embedOptions;
options.baseURL = "gallery/events/";
}

function onGalleryLoaded1(e:Event):void{
    mcLoader.mcFrame.width = 1204
    mcLoader.mcFrame.height = 667
    mcLoader.mcFrame.width = stage.stageWidth - mcLoader.x - 300;
    mcLoader.mcFrame.height = stage.stageHeight - mcLoader.y - 290;
    svAPI = Object(svLoader1.content).api;
    svAPI.setSize(mcLoader.mcFrame.width,mcLoader.mcFrame.height);
}

and so on. Change the svLoader var and the functions on the different frame labels. Change you're resize code to the height and width of the mcLoader and mcFrame you loaded on the stage.
There is most likely a way to slim down this code, but it's a start.

good luck