# Deadline Approaching...Please help! - xml galleries

**URL:** <https://forum.kirupa.com/t/deadline-approaching-please-help-xml-galleries/200359>\
**Category:** flash\
**Created:** [September 11, 2006, 5:22pm UTC](https://forum.kirupa.com/t/deadline-approaching-please-help-xml-galleries/200359 "2006-09-11T17:22:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hombr3w311](https://avatars.discourse-cdn.com/v4/letter/h/f4b2a3/32.png) [@hombr3w311](https://forum.kirupa.com/u/hombr3w311)\
**Post date:** [September 11, 2006, 5:22pm UTC](https://forum.kirupa.com/t/deadline-approaching-please-help-xml-galleries/200359/1 "2006-09-11T17:22:50Z")

</div>

OK, 2 Things -

I am using a combination of the xml resize gallery , and have a question. After a long time searching, i cant EXACTALLY find what I need…

I need to add an additional dynamic text box that uses smooth scrolling to display a long description of the displayed picture.

how in the world?

AS CODE:  
var tnNr;  
spacing = 10;  
container.\_alpha = 0;  
var curLength;  
MovieClip.prototype.loadPic = function(pic, id) {  
info.text = “”;  
this.\_alpha = 0;  
this.loadMovie(pic);  
temp = this.\_parent.createEmptyMovieClip(“temp2”, 998);  
temp.onEnterFrame = function() {

var t = container.getBytesTotal(), l = container.getBytesLoaded();  
if (Math.round(l/t) == 1 && container.\_width != 0 && container.\_height != 0) {  
var w = container.\_width+spacing, h = container.\_height+spacing;  
border.resizeMe(w, h, id);  
delete this.onEnterFrame;  
}  
};  
};  
MovieClip.prototype.resizeMe = function(w, h, id) {  
var speed = 3;  
container.\_alpha = 0;  
this.onEnterFrame = function() {  
this.\_width += (w-this.\_width)/speed;  
this.\_height += (h-this.\_height)/speed;  
if (Math.abs(this.\_width-w)\<1 && Math.abs(this.\_height-h)\<1) {  
this.\_width = w;  
this.\_height = h;  
container.\_x = this.\_x-this.\_width/2+spacing/2;  
container.\_y = this.\_y-this.\_height/2+spacing/2;  
info.\_x = Math.round(this.\_x+this.\_height/2+spacing/2);  
container.\_alpha += 5;  
if (container.\_alpha\>90) {  
info.text = id;  
container.\_alpha = 100;  
delete this.onEnterFrame;  
}  
}  
};  
};  
function galleryChoice(q) {  
pArray = new Array();  
tArray = new Array();  
iArray = new Array();  
dArray = new Array();  
my\_xml = new XML();  
for (var j = 0; j\<curLength; j++) {  
this.th\_nav[“thmb”+j].removeMovieClip();  
}  
my\_xml.ignoreWhite = true;  
my\_xml.onLoad = function(loaded) {  
if (loaded) {  
gallery = this.firstChild.childNodes[q];  
curLength = gallery.childNodes.length;  
for (var i = 0; i\<gallery.childNodes.length; i++) {  
pArray.push(gallery.childNodes\*.attributes.source);  
tArray.push(gallery.childNodes\*.attributes.thumb);  
iArray.push(gallery.childNodes\*.attributes.title);  
dArray.push(gallery.childNodes\*.attributes.description);  
}  
}  
delay = setInterval(makeButtons, 50);  
};  
my\_xml.load(“gallery.xml”);  
}  
function makeButtons() {  
tnNr = 0;  
clearInterval(delay);  
for (var i = 0; i\<tArray.length; i++) {  
var thb = th\_nav.thmb.duplicateMovieClip(“thmb”+i, 1000+i);  
thb.id = i;  
thb.\_x = i%3_50;  
thb.\_y = Math.floor(i/3)50;  
}  
loadButtons();  
}  
function loadButtons() {  
var tbox = th\_nav[“thmb”+tnNr].box;  
tbox.loadMovie(tArray[tnNr]);  
temp = this.createEmptyMovieClip(“tmp”+tnNr, 999);  
temp.onEnterFrame = function() {  
bt = tbox.getBytesTotal();  
bl = tbox.getBytesLoaded();  
if (bt == bl && bt\>4) {  
nextButton();  
delete this.onEnterFrame;  
}  
};  
}  
function nextButton() {  
if (tnNr\<tArray.length-1) {  
tnNr++;  
loadButtons();  
} else {  
activateButtons();  
}  
}  
function activateButtons() {  
mainButtons();  
for (var i = 0; i\<pArray.length; i++) {  
var but = th\_nav[“thmb”+i];  
but.id = i;  
but.onRelease = function() {  
container.loadPic(pArray[this.id], iArray[this.id], dArray[this.id]);  
disButtons2(this.id);  
};  
}  
container.loadPic(pArray[0], iArray[0], dArray[0]);  
disButtons2(0);  
}  
butArray = new Array();  
butArray = [“gal1\_btn”, “gal2\_btn”, “gal3\_btn”, “gal4\_btn”];  
function mainButtons() {  
for (var i = 0; i\<butArray.length; i++) {  
this[butArray].id = i;  
this[butArray_].onRelease = function() {  
galleryChoice(this.id);  
disButtons(this.id);  
};  
}  
}  
function disButtons2(d) {  
for (var i = 0; i\<tArray.length; i++) {  
if (i != d) {  
this.th\_nav[“thmb”+i].enabled = 1;  
this.th\_nav[“thmb”+i].box.\_alpha = 100;  
} else {  
this.th\_nav[“thmb”+i].enabled = 0;  
this.th\_nav[“thmb”+i].box.\_alpha = 50;  
}  
}  
}  
function disButtons(d) {  
for (var i = 0; i\<butArray.length; i++) {  
if (i != d) {  
this[butArray\*].enabled = 1;  
this[butArray\*].gotoAndStop(1);  
} else {  
this[butArray\*].enabled = 0;  
this[butArray\*].gotoAndStop(2);  
}  
}  
}  
disButtons(0);  
galleryChoice(0);

* * *

secondly,  
I am using scotty’s vertical xml scroller and need it to start scrolling very slowly on load…

Here is it:

[http://www.epic-pc.com/vertgallery.swf](http://www.epic-pc.com/vertgallery.swf)

Please help my eyes feel crossed from searching and trying different code! Thanks you

AS CODE:  
MovieClip.prototype.easeY = function(y){  
this.onEnterFrame = function(){  
this.\_y = y-(y-this.\_y)/1.2;  
if(Math.abs(y-this.\_y) \<= 1){  
delete this.onEnterFrame;  
this.\_y = y;  
}  
}  
}  
spacing = 10;  
containerMC.\_alpha = 0;  
pArray = new Array();  
pictArray = new Array();  
captiont=new Array();  
MovieClip.prototype.loadPic = function(pic) {  
this.\_alpha = 0;  
this.loadMovie(pArray[pic]);  
caption\_txt.text=captiont[pic];  
this.\_parent.onEnterFrame = function() {  
var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();  
bar.\_visible = 1;  
per = Math.round((l/t)_100);  
if (t != 0 && Math.round(l/t) == 1 && containerMC.\_width != 0) {  
var w = containerMC.\_width+spacing, h = containerMC.\_height+spacing;  
border.resizeMe(w, h);  
bar.\_visible = 0;  
delete this.onEnterFrame;  
} else {  
bar.\_width = per;  
}  
};  
};  
MovieClip.prototype.resizeMe = function(w, h, pic) {  
var speed = 3;  
this.onEnterFrame = function() {  
this.\_width += (w-this.\_width)/speed;  
this.\_height += (h-this.\_height)/speed;  
if (Math.abs(this.\_width-w)\<1 && Math.abs(this.\_height-h)\<1) {  
this.\_width = w;  
this.\_height = h;  
containerMC.\_x = this.\_x-this.\_width/2+spacing/2;  
containerMC.\_y = this.\_y-this.\_height/2+spacing/2;  
containerMC.\_alpha = 100;  
delete this.onEnterFrame;  
}  
};  
};  
my\_xml = new XML();  
my\_xml.ignoreWhite = true;  
my\_xml.onLoad = function(success) {  
if (success) {  
for (var i = 0; i\<this.firstChild.childNodes.length; i++) {  
pictArray.push(this.firstChild.childNodes_.attributes.thumb);  
pArray.push(this.firstChild.childNodes\*.attributes.image);  
captiont.push(this.firstChild.childNodes\*.attributes.captiontx);  
}  
}  
delay = setInterval(makeMenu, 100);  
};  
my\_xml.load(“newgallery.xml”);  
var menu = this.createEmptyMovieClip(“menu\_tot”, 99);  
menu.setMask(mask);  
menu.\_x = mask.\_x;  
menu.\_y = mask.\_y;  
var sub\_menu = menu.createEmptyMovieClip(“menu”, 100);  
var p = 0;  
var q = 0;  
var loadper = 0;  
function makeMenu() {  
clearInterval(delay);  
var item = sub\_menu.createEmptyMovieClip(“pic”+q, q);  
item.loadMovie(pictArray[p]);  
var temp = \_parent.createEmptyMovieClip(“tmp”, 9999+q);  
temp.onEnterFrame = function() {  
var tot = item.getBytesTotal();  
var loa = item.getBytesLoaded();  
var per = Math.round(((loa/tot)_100)/(pictArray.length));  
loadBar.\_yscale = loadper+per;  
if (tot == loa && tot\>4) {  
item.id = p;  
loadper += per;  
if (q\>0) {  
item.\_y = sub\_menu[“pic”+(q-1)].\_y+sub\_menu[“pic”+(q-1)].\_height+10;  
} else {  
item.\_y = 0;  
}  
item.onRelease = function() {  
containerMC.loadPic(this.id);  
};  
nextItem();  
delete this.onEnterFrame;  
}  
};  
}  
var amount = pictArray.length-1;  
function nextItem() {  
if (q\<((pictArray.length)-1)) {  
q++;  
if (p\<(pictArray.length-1)) {  
p++;  
makeMenu();  
} else {  
p = 0;  
makeMenu();  
}  
} else {  
activateMenu();  
}  
}  
function activateMenu() {  
containerMC.loadPic(0);  
menu.onEnterFrame = function() {  
if (mask.hitTest(\_level0.\_root.\_xmouse, \_level0.\_root.\_ymouse)) {  
diffspacing = 20;  
diff = this.\_parent.\_ymouse - (this.\_y+diffspacing);  
scale = diff_100/(mask.\_height-2_diffspacing); // once to compensate, another to add  
scale = Math.max(0,Math.min(100,scale)); // confine within 0-\>100  
target = -scale_(sub\_menu.\_height-mask.\_height)/100;  
sub\_menu.easeY(target);  
}  
};  
}

Thanks you soo much!!
