Please have a look here: http://www.caffeineiv.com/picturenav/pictures.html
As you can see, you can scroll through the pictures by using the “<prev” or “>next” buttons OR by clicking on the individual numbers. I made it to where the numbers change colors when you click on them individually, but I can’t for the life of me figure out how to make the number corresponding to the picture change colors when you press the “<prev” or “>next” buttons! I’ve experimented with “if/else” statements for days now, but nothing is working. The pictures are loading from an XML file. Here’s the AS on the main timeline:
spacing = 10;
containerMC._alpha = 0;
var pArray = new Array();
var tArray = new Array();
if (_root.loadtheText.text == "NaN"+"%") {
_root.loadtheText.text = "";
_root.blackbar.visible = 0;
}
MovieClip.prototype.loadPic = function(pic) {
containerMC._alpha = 0;
cur = pic;
this.loadMovie(pArray[pic]);
this._parent.onEnterFrame = function() {
var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
_root.blackbar._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, pic);
_root.blackbar._visible = 0;
_root.loadtheText.text = "";
delete this._parent.onEnterFrame;
} else {
// gives the bar a max width 100. För att få 250 px t.ex: bar._width = per*2.5;
_root.loadtheText.text = 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;
picinfo.info.text = tArray[pic];
picinfo._x = border._x-picinfo._width/2;
blackbar._x = prevb._x+237.3;
blackbar._y = prevb._y+24.5;
loadtheText._x = blackbar._x+106;
loadtheText._y = blackbar._y-61.5;
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 += 10;
if (containerMC._alpha>99) {
containerMC._alpha = 100;
delete this.onEnterFrame;
}
}
};
};
var gallery_xml = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function(success) {
if (success) {
var gallery = this.firstChild;
// pathToPics = gallery.attributes.path;
for (var i = 0; i<gallery.childNodes.length; i++) {
tArray.push(gallery.childNodes*.attributes.title);
pArray.push(gallery.childNodes*.attributes.source);
}
containerMC.loadPic(0);
} else {
title_txt.text = "Error!";
}
};
gallery_xml.load("italy_gallery.xml");
prevb.onRelease = function() {
if (cur == 0) {
containerMC.loadPic(pArray.length-1);
} else {
this.onEnterFrame = function() {
if (containerMC._alpha<1) {
containerMC.loadPic(cur-1);
delete this.onEnterFrame;
} else {
containerMC._alpha -= 10;
}
};
}
};
nextb.onRelease = function() {
if (cur == pArray.length-1) {
containerMC.loadPic(0);
} else {
this.onEnterFrame = function() {
if (containerMC._alpha<1) {
containerMC.loadPic(cur+1);
delete this.onEnterFrame;
} else {
containerMC._alpha -= 10;
}
};
}
};
stop();
And this is the AS on the individual number buttons:
on (release) {
var colorful = new Color("_root.nav.button1");
colorful.setRGB(0xC25A1D);
if (cur == 0) {
this._parent.containerMC.loadPic(pArray.length-1);
} else {
this.onEnterFrame = function() {
if (this._parent.containerMC._alpha<1) {
this._parent.containerMC.loadPic(0);
delete this.onEnterFrame;
} else {
this._parent.containerMC._alpha -= 10;
}
};
}
}
on (rollOver) {
this._parent.overtxt.text = this._parent.tArray[0];
}
on (rollOut) {
this._parent.overtxt.text = "";
}
Can anyone help? “prevb” and “nextb” are the instance names for the previous and next buttons.
Thanks a TON in advance!
(I’d attach the .fla, but since it loads the pics from the .xml from the same folder, I’d have to attach the .xml and the pics for you to see the effect.)