ecco il codice associato alla pagina:

import mx.transitions.*;
import mx.transitions.easing.*;
//
var numberImages:Number = 12;
var thumbPerPage:Number = 4;
var numberSets = Math.ceil(numberImages/thumbPerPage);
var thumbPath:String = "gallery/thumb";
var imPath:String = "gallery/im";
var targetIm:String = imPath+1+".jpg";
var galleryPath:String = _root.pages.page2.gallery;
var numTh:Number = 1;
var numSet:Number = 1;
var num:Number = 1;
set1.gotoAndStop(2);
//
function arrayThumbs() {
for (var i = 1; i<=thumbPerPage; i++) {
var thumbName = this["th"+i];
thumbName.index = i;
thumbName._visible = true;
thumbName.onRollOver = function() {
this.gotoAndPlay("over");
};
thumbName.onRollOut = thumbName.onReleaseOutside=function () {
this.gotoAndPlay("out");
};
thumbName.onRelease = function() {
var numIm = this.index+((numSet-1)*thumbPerPage);
targetIm = imPath+numIm+".jpg";
mcLoader.loadClip(targetIm, imContainer);
};
}
numTh = ((numSet-1)*thumbPerPage)+1;
var targetThumb = thumbPath+numTh+".jpg";
mcLoaderThumbs.loadClip(targetThumb, th1.thContainer);
}
//
for (var i = 1; i<=numberSets; i++) {
var nameSet = this["set"+i];
nameSet.index = i;
nameSet.num.txtNum.text = i;
nameSet.onRollOver = function() {
if (numSet != this.index) {
this.gotoAndStop(2);
}
};
nameSet.onRollOut = nameSet.onReleaseOutside=function () {
if (numSet != this.index) {
this.gotoAndStop(1);
}
};
nameSet.onRelease = function() {
if (numSet != this.index) {
galleryPath["set"+numSet].gotoAndStop(1);
numSet = this.index;
arrayThumbs();
}
};
}
// btnNext
btnNext.onRollOver = function() {
this.gotoAndPlay("over");
};
btnNext.onRollOut = btnNext.onReleaseOutside=function () {
this.gotoAndPlay("out");
};
btnNext.onRelease = function() {
galleryPath["set"+numSet].gotoAndStop(1);
numSet += 1;
if (numSet>numberSets) {
numSet = 1;
}
arrayThumbs();
galleryPath["set"+numSet].gotoAndStop(2);
};
//
// btnPrev
btnPrev.onRollOver = function() {
this.gotoAndPlay("over");
};
btnPrev.onRollOut = btnPrev.onReleaseOutside=function () {
this.gotoAndPlay("out");
};
btnPrev.onRelease = function() {
galleryPath["set"+numSet].gotoAndStop(1);
numSet -= 1;
if (numSet == 0) {
numSet = numberSets;
}
arrayThumbs();
galleryPath["set"+numSet].gotoAndStop(2);
};
//------------------------------------------------------------------------------------------
//
// Loading Thumbs
//
var mcLoaderThumbs:MovieClipLoader = new MovieClipLoader();
var loadListenerThumbs:Object = new Object();
loadListenerThumbs.onLoadStart = function(mcTarget) {
var thumbName = galleryPath["th"+num];
thumbName.attachMovie("mcLoading", "mcLoading", 1);
thumbName.mcLoading._x = (thumbName._width-thumbName.mcLoading._width)/2;
thumbName.mcLoading._y = (thumbName._height-thumbName.mcLoading._height)/2;
};
loadListenerThumbs.onLoadComplete = function(mcTarget) {
var thumbName = galleryPath["th"+num];
thumbName.mcLoading.removeMovieClip();
thumbName.thContainer._alpha = 0;
};
loadListenerThumbs.onLoadInit = function(mcTarget) {
if (num<4) {
num++;
numTh++;
var targetThumb = thumbPath+numTh+".jpg";
var thumbName = galleryPath["th"+num];
mcLoaderThumbs.loadClip(targetThumb, thumbName.thContainer);
thumbName._visible = true;
if (numTh>numberImages) {
thumbName._visible = false;
}
} else {
num = 1;
}
var tweenAlpha = new Tween(mcTarget, "_alpha", None.easeIn, mcTarget._alpha, 100, .6, true);
};
mcLoaderThumbs.addListener(loadListenerThumbs);
//------------------------------------------------------------------------------------------
//
// Loading Image
//
var mcLoader:MovieClipLoader = new MovieClipLoader();
var loadListener:Object = new Object();
loadListener.onLoadStart = function(mcTarget) {
attachMovie("mcLoading", "mcLoading", 1);
mcLoading._x = imBorder._x+(imBorder._width-mcLoading._width)/2;
mcLoading._y = imBorder._y+(imBorder._height-mcLoading._height)/2;
attachMovie("mcPercents", "mcPercents", 2, {_x:mcLoading._x-8, _y:mcLoading._y+30});
};
loadListener.onLoadProgress = function(mcTarget, bytesLoaded, bytesTotal) {
var percents = Math.ceil(bytesLoaded/bytesTotal*100);
mcPercents.txtPercents.text = percents+"%";
};
loadListener.onLoadComplete = function(mcTarget) {
mcLoading.removeMovieClip();
mcPercents.removeMovieClip();
mcTarget._alpha = 0;
};
loadListener.onLoadInit = function(mcTarget) {
var tweenAlpha = new Tween(mcTarget, "_alpha", None.easeIn, mcTarget._alpha, 100, .6, true);
};
mcLoader.addListener(loadListener);
// End Loading Image
//------------------------------------------------------------------------------------------
mcLoader.loadClip(targetIm, imContainer);
arrayThumbs();