Well like for the pictures, you need to store the captions in an array... As Kirupa's tutorial does...
Here's a quick addition to your code... I've bolded my additions...
Stage.scaleMode = "noScale";
var current_pic:Number = 0;
var total_pics:Number;
var pics:Array = new Array();
var caption:Array = new Array();
var full_image_path:String = "web_images/";
function changeTitle(name:String) {
gallery_mc.title_txt.text = name;
gallery_mc.viewing_txt.text = "Viewing Image " + (current_pic + 1)
+ " of " + total_pics;
}
function loadImage(clip, src) {
changeTitle(pics[current_pic].name);
var max_pics:Number = total_pics - 1;
if(current_pic == 0) {
gallery_mc.prev_btn.enabled = false;
gallery_mc.prev_btn._alpha = 50;
} else if(current_pic == max_pics) {
gallery_mc.next_btn.enabled = false;
gallery_mc.next_btn._alpha = 50;
} else {
gallery_mc.prev_btn.enabled = true;
gallery_mc.next_btn.enabled = true;
gallery_mc.prev_btn._alpha = 100;
gallery_mc.next_btn._alpha = 100;
}
clip._alpha = 0;
clip.createEmptyMovieClip("image_mc", clip.getNextHighestDepth());
clip.image_mc.loadMovie(src);
clip.onEnterFrame = function() {
if(this._alpha >= 100) {
delete this.onEnterFrame;
}
this._alpha += 5;
}
}
//caption = [];
function init() {
gallery_mc.prev_btn.enabled = false;
gallery_mc.next_btn.enabled = false;
gallery_mc.prev_btn._alpha = 50;
gallery_mc.next_btn._alpha = 50;
var gallery_xml:XML = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function(success) {
if(success == true) {
var xml:XML = this.firstChild;
for(var j = 0; j < xml.childNodes.length; j++) {
pics.push({name:xml.childNodes[j].childNodes[0].firstChild.nodeValue,
image:xml.childNodes[j].childNodes[1].firstChild.nodeValue, url: xml.childNodes[j].childNodes[2].firstChild.nodeValue});
caption[j] = xml.childNodes[j].childNodes[3].firstChild.nodeValue;
}
total_pics = pics.length;
if(total_pics > 1) {
gallery_mc.next_btn.enabled = true;
gallery_mc.next_btn._alpha = 100;
}
loadImage(gallery_mc.image_holder_mc, full_image_path + pics[current_pic].image);
gallery_mc.caption_txt.text = caption[0];
}
}
gallery_xml.load('web_list.xml');
}
gallery_mc.prev_btn.onRelease = function() {
if(current_pic > 0) {
current_pic--;
gallery_mc.caption_txt.text = caption[current_pic];
loadImage(gallery_mc.image_holder_mc, full_image_path + pics[current_pic].image);
}
}
gallery_mc.next_btn.onRelease = function() {
if(current_pic < total_pics - 1) {
current_pic++;
gallery_mc.caption_txt.text = caption[current_pic];
loadImage(gallery_mc.image_holder_mc, full_image_path + pics[current_pic].image);
}
}
init();
The above should at least get your captions displayed...
But you must make more corrections...
I'll explain when you get this working first...
Regards.
FLASH HELP - OPENED FOR BUSINESS!
TO GET YOUR OWN FREE WEBSITE HOSTING