home *** CD-ROM | disk | FTP | other *** search
- function smoothImageLoad(imgURL, targetMovie)
- {
- var _loc1_ = new Object();
- var _loc2_ = new MovieClipLoader();
- _loc1_.onLoadInit = function(mc)
- {
- sizeImage(mc);
- };
- _loc1_.onLoadComplete = function(mc)
- {
- imgGallery.gotoAndPlay("image_fade");
- };
- _loc2_.addListener(_loc1_);
- _loc2_.loadClip(imgURL,targetMovie);
- }
- function sizeWideImage(target_mc)
- {
- mw = target_mc._width;
- mh = target_mc._height;
- ratio = ow / mw;
- fw = mw * ratio;
- fh = mh * ratio;
- if(fh > oh)
- {
- ratio = oh / fh;
- fh *= ratio;
- fw *= ratio;
- }
- target_mc._width = fw;
- target_mc._height = fh;
- xoff = (ow - fw) / 2;
- yoff = (oh - fh) / 2;
- target_mc._x = xoff;
- target_mc._y = yoff;
- }
- function sizeTallImage(target_mc)
- {
- mw = target_mc._width;
- mh = target_mc._height;
- ratio = oh / mh;
- fw = mw * ratio;
- fh = mh * ratio;
- if(fw > ow)
- {
- ratio = ow / fw;
- fh *= ratio;
- fw *= ratio;
- }
- target_mc._width = fw;
- target_mc._height = fh;
- xoff = (ow - fw) / 2;
- yoff = (oh - fh) / 2;
- target_mc._x = xoff;
- target_mc._y = yoff;
- }
- function sizeImage(target_mc)
- {
- if(target_mc._width > target_mc._height)
- {
- sizeWideImage(target_mc);
- }
- else
- {
- sizeTallImage(target_mc);
- }
- }
- function mainLoop()
- {
- if(active)
- {
- imageTimer += 1;
- if(imageTimer >= imageDelay)
- {
- curImage != imgList.length - 2 ? (curImage += 1) : (curImage = 0);
- imageTimer = 0;
- gotoAndStop("preloader_fade");
- play();
- }
- }
- }
- function loadNext()
- {
- smoothImageLoad(imgList[curImage],imgLoader);
- }
- function loadImages(imgs)
- {
- imgList = imgs;
- curImage = 0;
- trace(imgList[curImage]);
- smoothImageLoad(imgList[curImage],imgLoader);
- imgGallery.gotoAndStop("loading_image");
- active = true;
- }
- var imgList = new Array();
- var mcl = new MovieClipLoader();
- var mclListener = new Object();
- var imageDelay = 5;
- var imageTimer = 0;
- var curImage = 0;
- var imgGallery = this;
- var active = false;
- var ow = 420;
- var oh = 262;
- _global.galleryClip = this;
- imgLoader.smoothImageLoadComplete = function()
- {
- sizeImage(this);
- galleryClip.gotoAndPlay("image_fade");
- };
- var loopTimer = setInterval(mainLoop,1000);
-