Hi, I built the photogallery (actually four!)
http://www.kirupa.com/developer/mx2004/thumbnails.htm
with a main gallery that loads the four categories.
I originally had the category names appear on rollover using hover captions.
http://www.kirupa.com/developer/mx2004/hover_captions.htm
Worked great!
Now the client wants to nix the hover captions and add labels in text. I thought it would be a cinch to code but I am not getting anywhere with it.
Here is the code I have…
clearInterval(myInterval);
import mx.utils.Delegate;
Instruction._visible = false;
delay = 3000;
var tip:MovieClip = this.attachMovie("toolTip", "tooltip", 10000);
tip._alpha = 0;
//////////////
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
title = [];
thumbnails = [];
category = [];
link = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
title* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
thumbnails* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
category* = xmlNode.childNodes*.childNodes[3].firstChild.nodeValue;
link* = 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("main2.xml");
////////////////////////////////////
p = 0;
var centerX = 380;
var centerY = 275;
//preloader._visible = true;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
//preloader._visible = true;
if (loaded != filesize) {
//preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
this.cartBtn._alpha += 5;
this.cartBtn._alpha += 5;
this.contactBtn._alpha += 5;
this.upcmngBtn._alpha += 5;
this.PressBtn._alpha += 5;
this.aboutBtn._alpha += 5;
this.MainTxt._alpha += 5;
picture._x = centerX-picture._width/2;
picture._y = centerY-picture._height;
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 5;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha -= 10;
picture.loadMovie(image[p], 1);
title_txt.text = title[p];
//desc_txt.text = category[p];
picture_num();
slideshow();
}
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
title_txt.text = title[0];
//desc_txt.text = category[0];
Instruction._visible = true;
picture_num();
slideshow();
}
}
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
}
}
this.mask_mc.onRollOver = over;
this.mask_mc.onRollOut = out;
function over() {
clearInterval(myInterval);
}
function out() {
slideshow();
}
hit_right._alpha = 0;
hit_left._alpha = 0;
function thumbNailScroller() {
// thumbnail code!
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 5;
tscroller.onEnterFrame = function() {
if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
if ((_root._xmouse>=(hit_right._x-76)) && (thumbnail_mc.hitTest(hit_right))) {
thumbnail_mc._x -= scroll_speed;
} else if ((_root._xmouse<=266) && (thumbnail_mc.hitTest(hit_left))) {
thumbnail_mc._x += scroll_speed;
}
} else {
delete tscroller.onEnterFrame;
}
};
}
var empty = category[k].nodeValue == null;
var full = category[k].nodeValue != null;
var thumb = ("thumbnail_mc.t"+k);
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
if (category[k].nodeValue == null && full>=5) {
target_mc._x = (hit_left._x-168)+(eval("thumbnail_mc.t"+k)._width+7)*k;
} else {
thumb.unloadClip();
target_mc._x = (hit_left._x-120)+(eval("thumbnail_mc.t"+k)._width+7)*k;
}
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
_root.loadMovie(link[k], this.getNextHighestDepth());
clearInterval(myInterval);
nextImage();
};
target_mc.onRollOver = function() {
//_root.tip.tipBox_mc.tipText.text = category[k];
// _root.tip.onEnterFrame = Delegate.create(this, moveTip);
// _root.tip._alpha = 100;
// _root.tip.tipText._visible = true;
// _root.tip.tipBox_mc._width = 8*tip.tipBox_mc.tipText.text.length;
//this._alpha = 50;
thumbNailScroller();
};
/*target_mc.onRollOut = function() {
this._alpha = 100;
delete _root.tip.onEnterFrame;
_root.tip._alpha = 0;
_root.tip.tipText._visible = false;
};
};*/
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
/*function moveTip() {
_root.tip._x = _xmouse;
_root.tip._y = 379;
}*/
I have added a movieclip “thumbTxt” to the library with a dynamic text field “tipText” in it. I would like to attach it to the thumbnail, add the label from the XML and position it above the thumbnails. I have tried attach movie and I am just at my wits end. I have googled and can’t find a solution that works for me. I have a feeling it is something simple that I am just not seeing. I appreciate any help. Thanks.