Hi everyone!
I’ve posted a couple times in the past, and you have all been very helpful, thank you!
I’ve tried to do my part in helping others, but it’s time I need help again.
I made a slideshow based off the following tutorial: http://www.kirupa.com/developer/mx2004/thumbnails.htm (yes thanks again kirupa!)
I edited the code a bit to suit my needs, nothing major though until now
I need to add alternate views of some of the slides.
I have started adding the code, and get the thumbnails to show up correctly when the corresponding slide is chosen from the main thumbnail slider. The problem is they refuse to be interactive. I’m trying to make the alpha change when they’re moused over, as well as load the correct slide when clicked. Nothing works - neither the alpha nor the click action. [Note: I have not written the code for the click action since the rollovers are not yet working]
Strange thing is the code I’m using for the alternate view thumbnails is almost identical to stuff I’ve used not only earlier in the program, but in the past as well.
So in short, I am having trouble making the alternate view thumbnails interactive, I’m not sure if I’m way off or if its just a silly mistake that I havnt caught yet, but ive been looking at it for awhile now, and i think a few fresh eyes would help. I have posted this problem in the AS1.0/2.0 Forum, because I had used AS2, however I’m starting to think this problem may be related to CS3, since the code seems valid.
If you need the FLA file, I will send it to you upon request.
Also - I have not worked with AS3 very much, since it seems as though it has been completely reworked and commands I have worked with in the past do not work with it. If this is something that can be solved by switching to AS3 and someone can help me with this, I am not opposed to doing this, just be aware: I’m a total n00b in AS3.
Here’s the code: (this is the entire program, and I will post JUST the thumbnail code below it, so you don’t have to wade through the whole thing, but I’m not sure if you might need the program for reference.)
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
thumbnails = [];
alt1path = [];
alt1thumb= [];
alt2path = [];
alt2thumb = [];
alt3path = [];
alt3thumb = [];
alt4path = [];
alt4thumb = [];
alt5path = [];
alt5thumb = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
thumbnails* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
alt1path* = xmlNode.childNodes*.childNodes[3].firstChild.nodeValue;
alt1thumb* = xmlNode.childNodes*.childNodes[4].firstChild.nodeValue;
alt2path* = xmlNode.childNodes*.childNodes[5].firstChild.nodeValue;
alt2thumb* = xmlNode.childNodes*.childNodes[6].firstChild.nodeValue;
alt3path* = xmlNode.childNodes*.childNodes[7].firstChild.nodeValue;
alt3thumb* = xmlNode.childNodes*.childNodes[8].firstChild.nodeValue;
alt4path* = xmlNode.childNodes*.childNodes[9].firstChild.nodeValue;
alt4thumb* = xmlNode.childNodes*.childNodes[10].firstChild.nodeValue;
alt5path* = xmlNode.childNodes*.childNodes[11].firstChild.nodeValue;
alt5thumb* = xmlNode.childNodes*.childNodes[12].firstChild.nodeValue;
thumbnails_fn(i);
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("portimages2.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
//btn_link.onRelease = function (){
// getURL ("http://"+description[p], _blank);
//}
/////////////////////////////////////
p = 0;
q = 0;
thu
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;
picwidth = picture._width;
picheight = picture._height;
picture._x = (590-picwidth)/2;
picture._y = (420-picheight)/2;
if (picture._alpha<100) {
picture._alpha += 10;
alt_thumbs_fn(p);
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.x = (590-picture.width)/2;
picture.y = (420-picture.height)/2;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
alt_thumbs_fn(p);
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.x = (590-picture.width)/2;
picture.y = (420-picture.height)/2;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
alt_thumbs_fn(p);
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[p];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
function thumbNailScroller() {
// thumbnail code!
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 10;
tscroller.onEnterFrame = function() {
if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right))) {
thumbnail_mc._x -= scroll_speed;
} else if ((_root._xmouse<=40) && (thumbnail_mc.hitTest(hit_left))) {
thumbnail_mc._x += scroll_speed;
}
} else {
delete tscroller.onEnterFrame;
}
};
}
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+5)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
}
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
}
target_mc.onRollOut = function() {
this._alpha = 100;
}
}
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
function alt_thumbs_fn() {
thumbholder1.loadMovie(alt1thumb[p], thumbholder1.getNextHighestDepth());
thumbholder1.onRelease = function (p,q) {
q = alt1path[p];
altload(q);
}
thumbholder1.onRollOver = function() {
this._alpha = 50;
}
thumbholder1.onRollOut = function() {
this._alpha = 100;
}
thumbholder2.loadMovie(alt2thumb[p], thumbholder2.getNextHighestDepth());
thumbholder2.onRelease = function (p,q) {
q = alt2path[p];
altload(q);
}
thumbholder2.onRollOver = function() {
this._alpha = 50;
}
thumbholder2.onRollOut = function() {
this._alpha = 100;
}
thumbholder3.loadMovie(alt3thumb[p], thumbholder3.getNextHighestDepth());
thumbholder3.onRelease = function (p,q) {
q = alt3path[p];
altload(q);
}
thumbholder3.onRollOver = function() {
thumbholder3._alpha = 50;
}
thumbholder3.onRollOut = function() {
thumbholder3._alpha = 100;
}
thumbholder4.loadMovie(alt4thumb[p], thumbholder4.getNextHighestDepth());
thumbholder4.onRelease = function (p,q) {
q = alt4path[p];
altload(q);
}
thumbholder4.onRollOver = function() {
thumbholder4._alpha = 50;
}
thumbholder4.onRollOut = function() {
thumbholder4._alpha = 100;
}
thumbholder5.loadMovie(alt5thumb[p], thumbholder5.getNextHighestDepth());
thumbholder5.onRelease = function (p,q) {
q = alt5path[p];
altload(q);
}
thumbholder5.onRollOver = function() {
thumbholder5._alpha = 50;
}
thumbholder5.onRollOut = function() {
thumbholder5._alpha = 100;
}
}
function altload(q) {
}
Alt View code:
function alt_thumbs_fn() {
thumbholder1.loadMovie(alt1thumb[p], thumbholder1.getNextHighestDepth());
thumbholder1.onRelease = function (p,q) {
q = alt1path[p];
altload(q);
}
thumbholder1.onRollOver = function() {
this._alpha = 50;
}
thumbholder1.onRollOut = function() {
this._alpha = 100;
}
thumbholder2.loadMovie(alt2thumb[p], thumbholder2.getNextHighestDepth());
thumbholder2.onRelease = function (p,q) {
q = alt2path[p];
altload(q);
}
thumbholder2.onRollOver = function() {
this._alpha = 50;
}
thumbholder2.onRollOut = function() {
this._alpha = 100;
}
thumbholder3.loadMovie(alt3thumb[p], thumbholder3.getNextHighestDepth());
thumbholder3.onRelease = function (p,q) {
q = alt3path[p];
altload(q);
}
thumbholder3.onRollOver = function() {
thumbholder3._alpha = 50;
}
thumbholder3.onRollOut = function() {
thumbholder3._alpha = 100;
}
thumbholder4.loadMovie(alt4thumb[p], thumbholder4.getNextHighestDepth());
thumbholder4.onRelease = function (p,q) {
q = alt4path[p];
altload(q);
}
thumbholder4.onRollOver = function() {
thumbholder4._alpha = 50;
}
thumbholder4.onRollOut = function() {
thumbholder4._alpha = 100;
}
thumbholder5.loadMovie(alt5thumb[p], thumbholder5.getNextHighestDepth());
thumbholder5.onRelease = function (p,q) {
q = alt5path[p];
altload(q);
}
thumbholder5.onRollOver = function() {
thumbholder5._alpha = 50;
}
thumbholder5.onRollOut = function() {
thumbholder5._alpha = 100;
}
}
I am aware that the altload function is empty - I am trying to get the alpha to work before hand, since the code for the altload function is easy enough to write, I just am trying to debug this problem before I get too ahead, in case I need to change the program around a lot.
I have tried using a trace command for rollovers, and it doesn’t trace anything, so for some reason the movieclips (thumbholder1-5) are “not” being rolled over, although they are on the second to top layer, and each time they are loaded they get the next highest depth, and they are visible.
I’m so confused. haha.:crazy:
Thank you all very much in advance, and sorry for the excessively long code.:s: