Would someone be so kind and a have look at the code and pinpoint me in the right direction
to stop the slideshow when a thumb is clicked?
It’s rhamejs gallery from source/experiments.
Everything i’ve tried (if/else statements) did not work, even setInterval.
Lightweight files are -here-.
stop();
//-------------------------------------------------------------
//set the initial postitions/properties of every thing.
scroller.prevBtn._visible = false;
.....
mainBox._height = 1;
//-------------------------------------------------------------
// define the stage resize events
var sl:Object = new Object();
sl.onResize = function() {
if (nav == "nobuttons") {
.....
Stage.addListener(sl);
sl.onResize();
//-------------------------------------------------------------
// define the vars
var frwrd:Boolean = true;
var pictures:Array = new Array();
var p:Number = -1;
var z:Number;
var clickCount:Number = 0;
var howMclick:Number;
var slideCount:Number = -1;
var images:Array = new Array();
var numOfBtns:Array = new Array();
var xml:XML = new XML();
var fadeOut:Boolean;
var setIt:Boolean = false;
var nextImage;
var mainColor;
var nextLink;
//-------------------------------------------------------------
// set the colors
.....
//-------------------------------------------------------------
//Load the XML and set all the arrays, blah blah blah....
xml.ignoreWhite = true;
xml.onLoad = function(ok) {
if (ok) {
allData = this.firstChild.childNodes;
for (var i = 0; i<allData.length; i++) {
var newBut:MovieClip = scroller.container.attachMovie("thumbMC", "thumb"+i, i);
var bgcolor:Color = new Color(newBut.thumbBg);
bgcolor.setRGB(thBgColor);
var preloaderColor:Color = new Color(newBut.bar);
preloaderColor.setRGB(barColor);
newBut.bgColor = allData*.attributes.color;
newBut.descript = allData*.firstChild.firstChild;
newBut.image = allData*.firstChild.nextSibling.firstChild;
newBut.link = (allData*.firstChild.nextSibling.nextSibling.firstChild);
pictures.push(allData*.firstChild.nextSibling.firstChild);
numOfBtns* = "but"+i;
newBut.slideCounter = i;
newBut._visible = false;
newBut.endY = -1;
newBut.endX = i*(100);
if (nav == "buttons") {
newBut._x = i*(100);
} else {
newBut._x = 0;
}
howMclick = Math.floor(scroller.container._width/700);
//-------------------------------------------------------------
newBut.onRelease = function() {
checkThumbs();
if (showSlide == false) {
trace(showSlide.valueOf());
slideCount = this.slideCounter;
}
preloader_mc._visible = true;
preloader_mc.gotoAndPlay(2);
infoBox.infoText.text = this.descript;
nextImage = this.image;
mainColor = this.bgColor;
nextLink = this.link;
fadeOut = true;
fadeMain();
this.enabled = false;
};
.....
};
}
//-------------------------------------------------------------
// when all done with above caca, load the first thumb
nextPic();
}
};
//-------------------------------------------------------------
// slide the info box down
.....
//-------------------------------------------------------------
////load each thumb incrementaliy
// Step one, check to see if p is less than pictures array
function nextPic() {
p++;
if (p<pictures.length) {
moveThumbs();
if (setIt == true) {
scroller.setRollOver();
}
if (p>6 && nav == "buttons") {
scroller.prevBtn._visible = true;
scroller.nextBtn._visible = true;
}
} else {
counterText_mc.loadingText.text = "";
}
}
//-------------------------------------------------------------
// Step two, call the function to show the thumb
.....
//-------------------------------------------------------------
// load the thumb image
function loadThumbs() {
var but:MovieClip = scroller.container["thumb"+p];
but.thumbClip.loadMovie("images/"+pictures[p]);
var temp:MovieClip = _root.createEmptyMovieClip("temp"+p, p);
counterText_mc.loadingText.text = (p+1)+" / "+pictures.length;
temp.onEnterFrame = function() {
BL = but.thumbClip.getBytesLoaded();
BT = but.thumbClip.getBytesTotal();
percent = Math.round(BL/BT*100);
but.bar.gotoAndStop(percent);
if (BL == BT && but.thumbClip._width>1 && but.thumbClip._height>1) {
but.bar.gotoAndStop(1);
but.thumbClip._width = 80;
but.thumbClip._height = 80;
if (firstLoad == 1) {
but.onRelease();
but.fadeIn = true;
but.thumbClip._alpha = 100;
firstLoad = false;
} else {
but.fadeIn = false;
but.thumbClip.fade();
}
nextPic();
delete temp.onEnterFrame;
}
};
}
//-------------------------------------------------------------
//re-enable the disabled thumb button when another is clicked
function checkThumbs() {
for (var j = 0; j<=numOfBtns.length; j++) {
var theThumb:MovieClip = scroller.container["thumb"+j];
if (theThumb.enabled == false) {
theThumb.enabled = true;
theThumb.thumbClip.fadeIn = false;
theThumb.thumbClip.fade();
}
}
}
//-------------------------------------------------------------
// fade IN/OUT the thumb image on rollOver rollOut
.....
};
//-------------------------------------------------------------
/*loadMain image. Even though it already preloaded in the thumb,
we want to make sure its there before we reveal it, plus we need to make sure all the other crap happens*/
function loadMainImage() {
mtClip.loadMovie("images/"+nextImage);
var temp:MovieClip = _root.createEmptyMovieClip("temp", 99999);
temp.onEnterFrame = function() {
trace('loading');
if (mtClip._width>5 && mtClip._height>5) {
if (showSlide == true) {
trace(showSlide.valueOf());
timer_mc.gotoAndPlay(2);
}
preloader_mc._visible = false;
preloader_mc.gotoAndStop(1);
mtClip._x = Stage.width/2-mtClip._width/2;
mtClip._y = Stage.height/2.-mtClip._height/2-50;
var mainBoxX:Number = mtClip._x-imageBorder;
var mainBoxY:Number = mtClip._y-imageBorder;
var mainBoxW:Number = mtClip._width+imageBorder*2;
var mainBoxH:Number = mtClip._height+imageBorder*2;
mainBox.tween("_width",mainBoxW,mainBoxTweenSpeed,mainBoxType,0);
mainBox.tween("_height",mainBoxH,mainBoxTweenSpeed,mainBoxType,0);
mainBox.tween("_x",mainBoxX,mainBoxTweenSpeed,mainBoxType,0);
mainBox.tween("_y",mainBoxY,mainBoxTweenSpeed,mainBoxType,0);
mainBackground.colorTo(mainColor,colorSpeed,"easeOutQuad");
mainBox._visible = true;
fadeOut = false;
fadeMain();
.....
delete temp.onEnterFrame;
trace('deleted');
}
};
}
//-------------------------------------------------------------
// fade IN/OUT the main image
function fadeMain() {
if (this.fadeOut == true) {
mtClip.tween("_alpha",0,fadeOutMainSpeed,"easeOutQuad",0,loadMainImage);
} else {
mtClip.tween("_alpha",100,fadeInMainSpeed,"easeOutQuad",0);
}
}
//-------------------------------------------------------------
//slide the thumbs left or right if set to "buttons"
function slideMain() {
var overlap:Number = .03;
var count:Number = 0;
var decount:Number = pictures.length;
if (frwrd == true) {
for (z=0; z<decount; z++) {
var ending:Number = scroller.container["thumb"+z].endX-700;
count++;
scroller.container["thumb"+z].tween("_x",ending,thumbSlideTweenSpeed,slideType,overlap*count);
scroller.container["thumb"+z].endX = ending;
}
} else {
for (z=decount-1; z>=0; z--) {
var ending:Number = scroller.container["thumb"+z].endX+700;
count++;
scroller.container["thumb"+z].tween("_x",ending,thumbSlideTweenSpeed,slideType,overlap*count);
scroller.container["thumb"+z].endX = ending;
}
}
}
//-------------------------------------------------------------
// slide show function
function slideShow() {
slideCount++;
if (showSlide == true) {
trace(showSlide.valueOf());
if (slideCount == pictures.length) {
slideCount = 0;
}
var butCount:MovieClip = scroller.container["thumb"+slideCount];
butCount.onRelease();
butCount.thumbClip._alpha = 100;
}
}
//-------------------------------------------------------------
//button actions
scroller.nextBtn.onRelease = function() {
if (clickCount<howMclick) {
clickCount++;
frwrd = true;
slideMain();
}
};
scroller.prevBtn.onRelease = function() {
if (clickCount != 0) {
clickCount--;
frwrd = false;
slideMain();
}
};
//-------------------------------------------------------------
timer_mc.onRelease = function() {
if (showSlide == false) {
trace(showSlide.valueOf());
timer_mc.gotoAndPlay(2);
showSlide = true;
trace(showSlide.valueOf());
timer_mc.timerText.text = "ON";
} else {
trace(showSlide.valueOf());
timer_mc.gotoAndStop(1);
timer_mc.timerText.text = "OFF";
}
};
//-------------------------------------------------------------
// fire it all off! BAM!
xml.load("gallery.xml");
On timeline of timer_mc(which starts and stops the Slideshow)
1frame
stop();
_parent.showSlide = false;
last frame
_parent.slideShow();
gotoAndStop(2);
Very grateful for every little help, it’s some days I’m working on it without succeeding and I
need it for a internal school project.
Thanks.