I’ve tried looking round these forums but can’t seem to find exactly what I need (or perhaps not totally understand the answers). I have set up a slideshow from code on the excellent resizing picture gallery post:
I essentially have this:
function slideshow(){
if (cur == 0) {
containerMC.loadPic(_root.scrll.image_array.length-1);
} else {
containerMC.loadPic(cur+1);
}
};
start.onRelease = function () {
var slideInterval = setInterval(slideshow, 4000);
}
stop.onRelease = function () {
clearInterval(slideInterval);
}
It starts just fine, but I can’t get it to stop.
However, if the line
var slideInterval = setInterval(slideshow, 4000);
is outside the onRelease function then it autostarts (which I don’t want) and then the stop button works.
Can I avoid the autostart, and have buttons which will start AND stop the show?
quickest on the draw once again:ninja: Thanks for the solution, work like a dream - didn’t try that (although I think I tried just about everything else!), and thanks for the ever-swift (and ever-correct) replies.
The photo site - Developing Dreams is getting close to launch, I’ll still due to send you a message when it goes up
b.t.w. you never did answer the question of whether you would like a Google email (gmail) account or not? It’s got one gig of storage, and I’ve still got a couple of invites going. Just pm me your email address if you would like an invite. Small thanks for all the help you provide, but the offer of some photos is still open once the site goes live.
the photo site is getting close (or at least closer), but I have another question which is driving me slowly round the bend and can’t seem to figure it out.
I am trying to load the first image in an array when I click a section button, i.e when you click on button one the first set of images loads AND the first image in that set loads in containerMC.
when I click the button it is showing that cur = 0, and when I click the ‘next’ button it is loading 1, which is fine BUT for the 0 I am getting ‘undefined’ and nothing is loading in the containerMC.
to the bottom of the xml load section in the ‘scroll’ movie:
gallery_xml.onLoad = function(success) {
if (success) {
var gallery = this.firstChild;
_root.thumb_array = new Array();
_root.image_array = new Array();
_root.title_array = new Array();
_root.filename_array = new Array();
for (j=0; j<gallery.childNodes[q].childNodes.length; j++) {
_root.image_array[j] = gallery.childNodes[q].childNodes[j].attributes.source;
_root.thumb_array[j] = gallery.childNodes[q].childNodes[j].attributes.thumbsrc;
_root.title_array[j] = gallery.childNodes[q].childNodes[j].attributes.title;
_root.filename_array[j] = gallery.childNodes[q].childNodes[j].attributes.filename;
//trace(thumb_array);trace(image_array);trace(title_array); trace(filename_array);
}
_root.containerMC.loadpic(0); // HERE
}
and it loads the first picture of each array when you click on a section just fine, but now the resizing function isn’t being triggered - so near and yet…
thanks for the reply. It looks good and I would never have thought of writing a function to cause the necessary delay! The only problem it seems is that when you go to say section 1 then section 2 then section 1 again the resize doesn’t happen (when you go back to section 1). Sorry to keep asking you slideshow questions and thanks again for the help, I’ll keep trying…
got it now…I was working with a stripped down version of the fla on another pc last night and I tried the code again on this pc with the full fla and it works perfectly.
Can’t understand why it didn’t work on the other version, must be an error elsewhere in that code, but I guess that version is obsolete now anyway. Thanks a lot Scotty, again a beautiful solution and one I would never have thought of.
hey Scotty, one more solution, one more problem…I’m now trying to load a .swf file into containerMC as an intro before any pics are loaded. I swear I’m nearly through bugging you with photo viewer questions:)
I have tried
_root.containerMC.loadPic(welcome.swf);
but think that the loadPic can only use array values. I tried loadMovie but that didn’t seem to work either.
Do I need to set up an array in the xml file to contain the name of the .swf and then load it from there? I’ve checked out similar posts so know it can be done but can’t seem to get any of the solutions to work. Any clues would be greatly appreciated, thanks!
I’ve posted the .fla here as it was too big to upload on the forums
thanks for the reply. Going back through some of the other versions on the main viewer thread I found that snippet of code. I tried it and the movie does load.
However the containerMC does not resize and the welcome.swf appears down and to the right of it…any other thoughts?
that looks like a top workaround, I never expected it to be so complicated! The whole idea of writing your own solution through a function is so great and I can now see the logic behind it after working with your other code. Thanks for sticking with it for me, it’s been very beneficial to see the kind of solutions you come up with for these problems; with every one of your posts I learn something new! Going to try it out now…
p.s. Did you see this nice addition to the original thread by Sipher?