JUst Stop...for the love of god

If the above works (you’re setting the interval two times…):

//this code on a button:
on(release){
clearInterval(myInterval);
}

scotty(-:

thanks for the response.

It does work actually, but I should look at that duplicate set interval. Anywho, how do I accomplish this without a button, i.e. stopping after the number of pic’s in the array??

curiously I just tried removing one and then the other --myInterval = setInterval(changePhoto, delay); – and it broke the slide show each time.

You’re right, I had a second look at the code and it should be there twice;)
(btw why you changed all the prototypes in normal functions?)

For stopping change the fadeIn function something like this?

function fadeIn() { 
if (mask_mc._alpha<100-fadeSpeed) { 
mask_mc._alpha += fadeSpeed; 
} else { 
mask_mc._alpha = 100; 
if(pIndex<yourvalue){
myInterval = setInterval(changePhoto, delay); 
onEnterFrame = null;
}else{
 onEnterFrame = null;
}
} 
}; 

and replace “yourvalue” with nr of the pic you want to stop.

scotty(-:

hmm, that didn’t work. Tried that in a number of locations + variations. Will an actual value like “8” work, or does this code just see +1?

"(btw why you changed all the prototypes in normal functions?)"
If you mean removing the _root, I did that because this is to be loaded into another movie. Didn’t seem to effect anything. Is that “bad” or just strange.

maybe this will work

changePhoto = function () {
// make sure pIndex falls within pArray.length
pIndex += 1;
onEnterFrame = fadeOut;
clearInterval(myInterval);
};
function fadeOut() {
if (mask_mc._alpha>fadeSpeed) {
mask_mc._alpha -= fadeSpeed;
} else if (Pindex>Parray.length) {
delete this.onEnterFrame;
} else {
delete this.onEnterFrame;
loadPhoto();
}
}

whoa…u ppl are like pros at this stuff…the only AS i know is- gotoandplay.

hey stringy, that did work, but oddly. I get an error “Error opening URL “file:///BACKUP/images/intro/””

I don’t think this is doing anything.

– } else if (Pindex>Parray.length) {
delete this.onEnterFrame; –

I think that the slideshow stops because something isn’t found. Kind of like extending the array to include a 9th image, but not placing one in the folder. But, perhaps that is a solution.

maybe it should be
} else if (Pindex>=Parray.length) {
delete this.onEnterFrame;

invisible7, can you post your fla?

scotty(-:

here it is. Also tried >= and a number of other permutations.

Probably an accident that the fps was 1??
Here’s the fla, I’ve put my code in and it worked…

scotty(-:

hmmm, It did the same as what I had before. Remove the pic9.jpg from the array and try it. This was why it stopped for me, an error in it’s quary for a non-existant jpg. When I remove pic9.jpg it just keeps looping. But, as i said, this may work because the end user wouldn’t know.

Yah, I changed fps to 1 because I couldn’t get the file size down, forgot to save&compress.

Let me make this clear, you want to stop this at the end, so no looping?
this line makes it loop

pIndex = ((pIndex + 1) < pArray.length) ? (pIndex + 1) : 0;

scotty(-:

yes that is what I want to do. What do you suggest should change.

You want the last picture to stay or end up with an “empty” screen?

scotty(-:

empty

oh

LOL
Here you go, comments are in the AS;)

scotty(-:

your a Prince and a Scholar. That worked perfectly. By the by I spent a lot of time looking for existing comments on a function similar to this on various flash sites before I posted a question and this same issue came up a number of times. Your the ONLY one who could come up with a solution.

you’re welcome:thumb: