I'm trying to modify a script I have downloaded a while ago. I want a image gallery for 20 images. It works fine for 10 images, but it isn't room for more than 10 thumbnails in one row on the stage, how can I modify this script so I can get 2 rows with thumbnails, 10 in each row? Is there anyone who can help me? Image Gallery
Here is my fla-file and images for download (zip):fla-file
And here is the code used:
Code:
MovieClip.prototype.fade = function() {
var v1:MovieClip = this;
v1.onEnterFrame = function() {
if (v1._alpha>0) {
v1._alpha -= 8;
if (v1._alpha<=0) {
v1._alpha = 0;
// when clip has faded out, load the image requested
$mcl.loadClip("vasanello/"+_root.mcID+".jpg", MT);
delete v1.onEnterFrame;
}
}
};
};
function pauseMe(t:Number) {
// t = number of seconds you want to pause
//this is just so you get the delay you want while loading
stop();
wait = t*500;
// converts time from milliseconds to seconds
go = function () {
clearInterval(stall);
// call the multiLoad function to continue loading thumbs/images.....
multiLoad();
};
stall = setInterval(go, wait);
}
// path /prefix to thumbnails --> filename ex. img_1.jpg stored in folder named t
var thmbPrefix:String = "vasanello/thumb/vasanello";
// path/prefix to images
var imgPrefix:String = "vasanello/vasanello";
// images must be numbered sequentially starting with 1....
var startNumber:Number = 1;
// tracking var for loading
var mcID;
// create the holder clip
var MT = this.createEmptyMovieClip("empty", 0);
// this function starts the load for each image
function multiLoad():Void {
// create a MovieClip to place the image into
var mc = this.createEmptyMovieClip("vasanello"+startNumber, startNumber);
// change cube color to indicate loaded...
_level0["cube"+startNumber].gotoAndStop("done");
// position the thumbnail on stage
mc._y = Stage.height-327;
mc._x = (startNumber-1)*41+0;
// generate the next image name
var imgName = (thmbPrefix+startNumber)+".jpg";
// load the IMAGE into the MovieClip we just created!
image_mcl.loadClip(imgName, mc);
// increment the start number
startNumber++;
}
// create MovieClipLoader object
var image_mcl:MovieClipLoader = new MovieClipLoader();
// create a listener for the MovieClipLoader class object
var mclListener:Object = new Object();
// add listener to object
image_mcl.addListener(mclListener);
// when an image has started loading, try loading the next image
mclListener.onLoadInit = function(target_mc:MovieClip) {
// hide the thumbnails clips
target_mc._visible = false;
// call the PAUSE function...wait 1 seconds...
pauseMe(1);
};
mclListener.onLoadComplete = function(target_mc:MovieClip) {
// rollover effect for thumbnails.. not necessary
target_mc.onRollOver = function() {
mx.transitions.TransitionManager.start(target_mc, {type:mx.transitions.Photo, direction:0, duration:1, easing:mx.transitions.easing.None.easeNone, param1:empty, param2:empty});
};
// load the fullsize image on release....
target_mc.onRelease = function() {
// remember which image to load...
_root.mcID = this._name;
//fade out the container clip
MT.fade();
};
};
mclListener.onLoadError = function(target_mc:MovieClip) {
// when thumbs have all loaded, load the first full size image
$mcl.loadClip("vasanello/vasanello1.jpg", MT);
trace("STOPPED LOADING!!!");
trace(target_mc+" does not contain an image");
// remove unnecessary movieClip
target_mc.removeMovieClip();
// because we have finished, hide the cubes and show the thumbnails
for (i=1; i<11; i++) {
_level0["vasanello"+i]._visible = true;
_level0["cube"+i]._visible = false;
}
};
//start the process off!
multiLoad();
//----> from this point on, the multiLoad function will
//----> be called from within the Pause function... to give you your delay
// create another MovieClipLoader object to load the images
var $mcl:MovieClipLoader = new MovieClipLoader();
// another listener
var $list:Object = new Object();
// add listener to object
$mcl.addListener($list);
$list.onLoadStart = function($target_mc:MovieClip) {
$target_mc._alpha = 0;
};
$list.onLoadInit = function($target_mc:MovieClip) {
// center the image on stage...
$target_mc._x = Math.round(Stage.width-$target_mc._width)/2;
$target_mc._y = Math.round(Stage.height-$target_mc._height)-0;
};
$list.onLoadComplete = function($target_mc:MovieClip) {
// make it visible...
$target_mc._alpha = 100;
};
in the multiLoad function check if the startNumber is less than 10 and position as usual
if the startNumber is greater than 10 make a new row by changing the _y and resetting the _x to start from the left again.
Haven't checked the code, but something like this should work.
// this function starts the load for each image
function multiLoad():Void {
// create a MovieClip to place the image into
var mc = this.createEmptyMovieClip("vasanello"+startNumber, startNumber);
// change cube color to indicate loaded...
_level0["cube"+startNumber].gotoAndStop("done");
// position the thumbnail on stage
if (startNumber<=10){
mc._y = Stage.height-327;
mc._x = (startNumber-1)*41+0;
}
else{
mc._y = Stage.height-300;
mc._x = (startNumber-11)*41+0;
}
// generate the next image name
var imgName = (thmbPrefix+startNumber)+".jpg";
// load the IMAGE into the MovieClip we just created!
image_mcl.loadClip(imgName, mc);
// increment the start number
startNumber++;
}
-------------------------------------------------- ‘There is no emoticon to express how I am feeling’ - Comic Book Guy
There's an effective, simple solution to carbon sequestration... it's called 'coal', so leave it alone!
There's an effective, simple solution to carbon capture....it's called 'trees', so plant some!
Glad to be of service, and nice to be called a hero - you've made me smile this morning
-------------------------------------------------- ‘There is no emoticon to express how I am feeling’ - Comic Book Guy
There's an effective, simple solution to carbon sequestration... it's called 'coal', so leave it alone!
There's an effective, simple solution to carbon capture....it's called 'trees', so plant some!