I have been trying to figure out what I am doing wrong and have gotten pretty close to a solution, but I can not seem to get it to work the way I want to.
What I am trying to do is use one xml file for multiple galleries, and add a menu that change the galleries… with my limited knowledge of actionscript I was able to modify the gallery in the tutorial and add some of Scotty’s great scripting, but have come to a point where I am still lost as what is really wrong with it. It seems to load the first gallery and even an image or two but I cant go to the different galleries and after a few minutes it just locks up completely…
Can someone please help???
Here is the action script:
var count:Number = 1;
var easeSpeed:Number = 6;
while (_root["gal_btn"+count]) {
_root["gal_btn"+(count)].id=count, _root["gal_btn"+(count++)].onPress=function () {
val = _root["gal_btn"+this.id];
};
}
ease.onEnterFrame = function() {
this._y += (val._y-ease._y)/easeSpeed;
};
delay = 7500;
//-----------------------
disButtons(0);
galleryChoice(0);
function galleryChoice(q) {
pArray = new Array();
iArray = new Array();
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = function(loaded) {
if (loaded) {
image = [];
description = [];
gallery = this.firstChild.childNodes[q];
total = gallery.childNodes.length;
for (var i = 0; i<total; i++) {
image* = gallery.childNodes*.attributes.source;
description* = gallery.childNodes*.attributes.title;
}
firstImage();
} else {
content = "file not loaded";
}
};
xmlData.load("images.xml");
}
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
slideshow();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
slideshow();
}
}
butArray = new Array();
butArray = ["gal_btn1", "gal_btn2", "gal_btn3", "gal_btn4"];
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 slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
}
}
function disButtons(d) {
for (var i = 0; i<butArray.length; i++) {
if (i != d) {
this[butArray*].enabled = 1;
this[butArray*].gotoAndPlay(1);
} else {
this[butArray*].enabled = 0;
this[butArray*].gotoAndPlay(2);
}
}
}
And here is the XML:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<menu>
<gallery name="weddings">
<image source="http://www.russfickettphotography.com/images/hands.jpg" title="wedding"/>
<image source="http://www.russfickettphotography.com/images/wedding.jpg" title="wedding"/>
<image source="http://www.russfickettphotography.com/images/wedding2.jpg" title="wedding"/>
<image source="http://www.russfickettphotography.com/images/wedding1.jpg" title="wedding"/>
</gallery>
<gallery name="portraits">
<image source="http://www.russfickettphotography.com/images/kids.jpg" title="portraits"/>
<image source="http://www.russfickettphotography.com/images/portrait.jpg" title="portraits"/>
</gallery>
<gallery name="landscapes">
<image source="http://www.russfickettphotography.com/images/light_wide.jpg" title="landscapes"/>
<image source="http://www.russfickettphotography.com/images/lighthouse.jpg" title="landscapes"/>
<image source="http://www.russfickettphotography.com/images/landscapes.jpg" title="landscapes"/>
</gallery>
<gallery name="other">
<image source="http://www.russfickettphotography.com/images/gate.jpg" title="other">
<image source="http://www.russfickettphotography.com/images/gate.jpg" title="other">
</gallery>
</menu>
Any help would be apreciated…