# Next/prev buttons of border resize gallery

**URL:** https://forum.kirupa.com/t/next-prev-buttons-of-border-resize-gallery/240607
**Category:** Uncategorized
**Created:** [October 4, 2007, 12:37pm UTC](https://forum.kirupa.com/t/next-prev-buttons-of-border-resize-gallery/240607 "2007-10-04T12:37:12Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![igorlaszlo](https://avatars.discourse-cdn.com/v4/letter/i/8e8cbc/32.png) [@igorlaszlo](https://forum.kirupa.com/u/igorlaszlo)
#### Post date: [October 4, 2007, 12:37pm UTC](https://forum.kirupa.com/t/next-prev-buttons-of-border-resize-gallery/240607/1 "2007-10-04T12:37:12Z")

</div>

I found an auto border resize gallery which is just perfect because it does not use XML. It is easier and faster load. However I would like to developpe this gallery with a “next” and “previous” buttons, navigating not only by thumbnails.  
I found a script (see below in [COLOR=red]RED[/COLOR]) in a similar resize gallery which uses xml , it should be changed to work without xml.  
Pls check it and let me know if you have an idea how the right script should be.  
Demo : [http://www.mozaikart.org/essai/essai1.htm](http://www.mozaikart.org/essai/essai1.htm)

## THE WHOLE SCRIPT :

stop();  
space = 25;  
photo\_mc.\_alpha = 100;  
var photo = new Array();

MovieClip.prototype.loadPhoto = function(photo){  
photo\_mc.\_alpha = 0;  
this.loadMovie(photo);  
\_level0.onEnterFrame = function(){  
// modified the total and loaded so as to round it up to smaller number.  
var total = Math.round photo\_mc.getBytesTotal)/ 1024);  
var loaded = Math.round(photo\_mc.getBytesLoaded()/1024);  
if (total != 0 && loaded\>=total){  
var w = photo\_mc.\_width + space;  
var h = photo\_mc.\_height + space;  
border.resize(w, h);  
delete this.onEnterFrame;  
picinfo.info.text = photo;  
delete this.onEnterFrame;  
}  
}  
};

MovieClip.prototype.resize = function(w, h){  
//the higher the slower the resize of the border  
var speed = 4;  
this.onEnterFrame = function(){  
this.\_width += (w - this.\_width)/speed;  
this.\_height += (h - this.\_height)/speed;  
nav.\_x = Math.round(this.\_x-this.\_width/2);  
nav.\_y = Math.round(this.\_y+this.\_height/2+spacing/2);  
prevb.\_x = nav.\_x-5;  
nextb.\_x = nav.\_x+this.\_width+5;  
nextb.\_y = prevb.\_y=this.\_y-this.\_height/2;  
picinfo.\_y = nextb.\_y-5;  
picinfo.\_x = border.\_x-picinfo.\_width/2;  
if( Math.abs(this.\_width-w)\<1 && Math.abs(this.\_height-h)\<1){  
this.\_width = w;  
this.\_height = h;  
photo\_mc.\_x = this.\_x - this.\_width/2 + space/2;  
photo\_mc.\_y = this.\_y - this.\_height/2 + space/2;  
photo\_mc.\_alpha = 100;  
delete this.onEnterFrame;  
}  
}  
};  
[COLOR=red][/COLOR]  
[COLOR=red]gallery\_xml.load(“gallery.xml”);  
prevb.onRelease = function() {  
cur–;  
if (cur\<0) {  
containerMC.loadPic(pArray.length-1);  
} else {  
containerMC.loadPic(cur);  
}  
};  
nextb.onRelease = function() {  
cur++;  
if (cur \> pArray.length-1) {  
containerMC.loadPic(0);  
} else {  
containerMC.loadPic(cur);  
}  
};[/COLOR]

pic1.onPress = function() {  
photo\_mc.loadPhoto(“p1.swf”);  
};  
pic2.onPress = function() {  
photo\_mc.loadPhoto(“p2.swf”);  
};  
pic3.onPress = function() {  
photo\_mc.loadPhoto(“p3.swf”);  
};  
pic4.onPress = function() {  
photo\_mc.loadPhoto(“p4.swf”);  
};  
pic5.onPress = function() {  
photo\_mc.loadPhoto(“p5.swf”);  
};  
pic6.onPress = function() {  
photo\_mc.loadPhoto(“p6.swf”);  
};  
pic7.onPress = function() {  
photo\_mc.loadPhoto(“p7.swf”);  
};  
pic8.onPress = function() {  
photo\_mc.loadPhoto(“p8.swf”);  
};  
pic9.onPress = function() {  
photo\_mc.loadPhoto(“p9.swf”);  
};

/////////////////////////////////////  
//Modified by Sokhodom Pheng //  
////////////////////////////////////  
//define the initiation function

function init(photo) {  
photo\_mc.loadPhoto(photo);  
}

// call the initiation function  
//change the image name accordingly

init(“p1.swf”);
