Hi i hope someone can shed some light on by novice AS writers block.
I am creating a photogallery with thumbnails that reads all the data from XML, this is based on the excellent Kirupa tutorial.
What i want to happen is that the text only appears when you mouseOver the image.
I thought it would be a simple using an if statement but can not get it to work.
you can view the page at http://www.bru-ha.com/roza-flash/art_7.swf
below is the actionscript for the file & the FLA.
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
media = [];
credit = [];
thumbnails = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
media* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
credit* = xmlNode.childNodes*.childNodes[3].firstChild.nodeValue;
thumbnails* = xmlNode.childNodes*.childNodes[4].firstChild.nodeValue;
thumbnails_fn(i);
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load('xml/art_7.xml');
///////////////////////////////////// preloader
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;
}
}
};
///////////////////////////////////////next and previous image function
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
text_mc.desc_txt.text = description[p];
text_mc.media_txt.text = media[p];
text_mc.credit_txt.text = credit[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
text_mc.desc_txt.text = description[p];
text_mc.media_txt.text = media[p];
text_mc.credit_txt.text = credit[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
text_mc.desc_txt.text = description[0];
text_mc.media_txt.text = media[0];
text_mc.credit_txt.text = credit[0];
picture_num();
}
}
/////////////////////////////////////////////////////////load thumbnails
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = hit_left._x+(eval("thumbnail_mc.t"+k)._width+10)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc._alpha = 30;
target_mc.onRollOver = function() {
target_mc.onEnterFrame = function() {
if (this._alpha<100) {
this._alpha += 15;
//or any other number you like, if it's too fast or too slow
} else {
this._alpha = 100;
this.onEnterFrame = null;
}
};
};
target_mc._alpha = 30;
target_mc.onRollOut = function() {
target_mc.onEnterFrame = function() {
if (this._alpha>30) {
this._alpha -= 15;
//or whatever number you used above
} else {
this._alpha = 30;
this.onEnterFrame = null;
}
};
};
};
//////////////////////////////////////////////////////////text fade
//text_mc._alpha = 0;
//picture.onRollOver = function() {
//picture.onEnterFrame = function() {
//if (text_mc._alpha<100) {
//text_mc._alpha += 15;
//} else {
//text_mc._alpha = 100;
//picture.onEnterFrame = null;
//}
//};
//};
//picture.onRollOut = function() {
//picture.onEnterFrame = function() {
//if (text_mc._alpha>100) {
//text_mc._alpha -= 15;
//} else {
//text_mc._alpha = 100;
//picture.onEnterFrame = null;
//}
//};
//};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
stop();
any pointers are gratefully recieved.
Cheers
Bo-doodle:look: