Thursday, April 21, 2011

Coding and Programming 3

Lastly, here is the script to load my gallery page.

//Example of loading multiple SimpleViewer swfs into another flash movie.

//init stage
//Stage.align = "TL";
//Stage.scaleMode = "noScale";
Stage.align = "";
Stage.scaleMode = "noScale";


//set width and height of SimpleViewer swf
_global.SVStageWidth = 640;
_global.SVStageHeight = 360;

var galleryId:Number;
var mLoader_mcl = new MovieClipLoader();
mLoader_mcl.addListener(this);

//Set button actions
mcGal1.onRelease = function(){
                loadGallery(1);  
}

mcGal2.onRelease = function(){
                loadGallery(2);
}

mcHide.onRelease = function(){
                mcLoader._visible = !mcLoader._visible;
}

function loadGallery(galId){
                galleryId = galId
                mLoader_mcl.loadClip("viewer.swf",mcLoader);
}

function onLoadInit(){
               
                //set gallery xml name
                _root.xmlDataPath = "gallery"+galleryId + ".xml";
                //set gallery specific options
                if (galleryId == 1){
                                com.airtightinteractive.apps.viewers.simpleViewer.Options.imageFrameColor = 0xffffff;
                }else{
                                com.airtightinteractive.apps.viewers.simpleViewer.Options.imageFrameColor = 0xff00ff;
                }
}

//load first gallery
loadGallery(1);

No comments:

Post a Comment