# JUst Stop...for the love of god

**URL:** https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757
**Category:** Uncategorized
**Created:** [July 21, 2004, 6:03am UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757 "2004-07-21T06:03:15Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![invisible7](https://avatars.discourse-cdn.com/v4/letter/i/779978/32.png) [@invisible7](https://forum.kirupa.com/u/invisible7)
#### Post date: [July 21, 2004, 6:03am UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/1 "2004-07-21T06:03:15Z")

</div>

okay, okay. I just can’t get this autoslideshow to stop. I would really appreciate any help you may have.

And for the curious and critical, pIndex is set to -1 rather than 0 because the load starts with the 2nd jpg if I don’t. Also, I removed “loadMovie(pathToPics+pArray[0], \_root.mask\_mc);” because I couldn’t make it fade up on load. If you care.

* * *

stop();

pathToPics = “images/intro/”;

pArray = [“pic1.jpg”,“pic2.jpg”,“pic3.jpg”,“pic4.jpg”,“pic5.jpg”,“pic6.jpg”,“pic7.jpg”,“pic8.jpg”];  
pIndex = -1;  
fadeSpeed = 2;  
delay = 2000;

//loadMovie(pathToPics+pArray[0], \_root.mask\_mc);  
changePhoto = function() {  
// make sure pIndex falls within pArray.length  
pIndex = ((pIndex + 1) \< pArray.length) ? (pIndex + 1) : 0;  
onEnterFrame = fadeOut;  
clearInterval(myInterval);  
};  
function fadeOut() {  
if (mask\_mc.\_alpha\>fadeSpeed) {  
mask\_mc.\_alpha -= fadeSpeed;  
} else {  
delete this.onEnterFrame;  
loadPhoto();  
}  
};  
function loadPhoto() {  
var p = mask\_mc;  
p.\_alpha = 0;  
p.loadMovie(pathToPics+pArray[pIndex]);  
onEnterFrame = loadMeter;  
};  
function loadMeter() {  
var i, l, t;  
l = mask\_mc.getBytesLoaded();  
t = mask\_mc.getBytesTotal();  
if (t\>0 && t == l) {  
onEnterFrame = fadeIn;  
}  
else {  
trace(l/t);  
}  
};  
function fadeIn() {  
if (mask\_mc.\_alpha\<100-fadeSpeed) {  
mask\_mc.\_alpha += fadeSpeed;  
} else {  
mask\_mc.\_alpha = 100;  
myInterval = setInterval(changePhoto, delay);  
onEnterFrame = null;  
}  
};  
myInterval = setInterval(changePhoto, delay);

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2004, 7:04am UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/2 "2004-07-21T07:04:38Z")

</div>

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

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

```

scotty(-:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2004, 7:18am UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/3 "2004-07-21T07:18:51Z")

</div>

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??

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2004, 7:22am UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/4 "2004-07-21T07:22:53Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2004, 9:01am UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/5 "2004-07-21T09:01:41Z")

</div>

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?

```auto
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(-:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2004, 2:45pm UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/6 "2004-07-21T14:45:30Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2004, 4:23pm UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/7 "2004-07-21T16:23:38Z")

</div>

> [@invisible7](#):
>
> 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();  
}  
}

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2004, 4:25pm UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/8 "2004-07-21T16:25:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2004, 5:15pm UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/9 "2004-07-21T17:15:01Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2004, 5:17pm UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/10 "2004-07-21T17:17:36Z")

</div>

> [@invisible7](#):
>
> 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;

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2004, 6:27pm UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/11 "2004-07-21T18:27:40Z")

</div>

invisible7, can you post your fla?

scotty(-:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2004, 6:37pm UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/12 "2004-07-21T18:37:16Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2004, 7:12pm UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/13 "2004-07-21T19:12:36Z")

</div>

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

scotty(-:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2004, 7:25pm UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/14 "2004-07-21T19:25:07Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2004, 7:31pm UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/15 "2004-07-21T19:31:46Z")

</div>

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

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

```

scotty(-:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 21, 2004, 8:30pm UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/16 "2004-07-21T20:30:17Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 22, 2004, 5:41am UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/17 "2004-07-22T05:41:43Z")

</div>

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

scotty(-:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 22, 2004, 6:05am UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/18 "2004-07-22T06:05:23Z")

</div>

empty

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 22, 2004, 7:01am UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/19 "2004-07-22T07:01:58Z")

</div>

oh

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

scotty(-:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 22, 2004, 1:59pm UTC](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757/20 "2004-07-22T13:59:13Z")

</div>

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.

[Next page](https://forum.kirupa.com/t/just-stop-for-the-love-of-god/116757.md?page=2)
