# Stopping a current frame

**URL:** <https://forum.kirupa.com/t/stopping-a-current-frame/185200>\
**Category:** Uncategorized\
**Created:** [April 11, 2006, 6:16pm UTC](https://forum.kirupa.com/t/stopping-a-current-frame/185200 "2006-04-11T18:16:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Freeseus](https://avatars.discourse-cdn.com/v4/letter/f/9e8a1a/32.png) [@Freeseus](https://forum.kirupa.com/u/Freeseus)\
**Post date:** [April 11, 2006, 6:16pm UTC](https://forum.kirupa.com/t/stopping-a-current-frame/185200/1 "2006-04-11T18:16:30Z")

</div>

Okay, so I’m trying to get a movieclip (lets call it ALFRED) to stop when I mouse over a button.

I want that movieclip to keep playing until it reaches that exact frame. Let’s call that frame “rank1.” “Rank1” happens to be on frame 100.

So, you mouse over… and the movieclip, ALFRED is in the middle of it’s animation or whatever and is currently on frame 35. Nothing should happen. A second later, when ALFRED reaches frame 100 or “Rank1” ALFRED should stop();

on(rollOver){  
if (\_root.ALFRED.\_currentframe = “rank1”) {  
\_root.ALFRED.stop();  
}  
}

Doesn’t work. Instead, when you roll your mouse over it, it stops ALFRED on whatever frame ALFRED happens to be on. Replacing “rank1” with frame “100” yields the same result.

Help anyone?

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [April 11, 2006, 6:25pm UTC](https://forum.kirupa.com/t/stopping-a-current-frame/185200/2 "2006-04-11T18:25:43Z")

</div>

use “=” to assign a value

use “==” to check a value

```auto
on(rollOver){
if (_root.ALFRED._currentframe == "rank1") {
_root.ALFRED.stop();
}
}

```

---

<div class="post-metadata">

**Author:** ![kortexvfd](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@kortexvfd](https://forum.kirupa.com/u/kortexvfd)\
**Post date:** [April 11, 2006, 6:29pm UTC](https://forum.kirupa.com/t/stopping-a-current-frame/185200/3 "2006-04-11T18:29:00Z")

</div>

Firstly, this:  
if (\_root.ALFRED.\_currentframe = “rank1”)

Should be  
if (\_root.ALFRED.\_currentframe **==** “rank1”)

A single = mean you are setting a value not checking for equality.

Secondly, it might be easier to do something like:

on ALFRED frame 100:

if (pauseme){  
stop();  
}else{  
//what ever else alfred should do if the button has not bee rolled over.  
}

on the button:  
on (rollOver){  
\_root.ALFRED.pauseme = true;  
}

that way alfred will keep going till 100 and stop cause pauseme will be true, but only true is the button has been rolled over.

---

<div class="post-metadata">

**Author:** ![Freeseus](https://avatars.discourse-cdn.com/v4/letter/f/9e8a1a/32.png) [@Freeseus](https://forum.kirupa.com/u/Freeseus)\
**Post date:** [April 11, 2006, 6:29pm UTC](https://forum.kirupa.com/t/stopping-a-current-frame/185200/4 "2006-04-11T18:29:11Z")

</div>

[FONT=Courier New][LEFT][COLOR=#0000ff]on[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]  
if [COLOR=#000000]([/COLOR][COLOR=#0000ff]\_root[/COLOR].[COLOR=#000080]ALFRED[/COLOR].[COLOR=#0000ff]\_currentframe[/COLOR] == [COLOR=#ff0000]“rank1”[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]  
root.[COLOR=#000080]ALFRED[/COLOR].[COLOR=#0000ff]stop[/COLOR]COLOR=#000000[/COLOR]  
}  
[/LEFT]

[/FONT]

ALFRED does not stop when mouseOver with the above script.

---

<div class="post-metadata">

**Author:** ![kortexvfd](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@kortexvfd](https://forum.kirupa.com/u/kortexvfd)\
**Post date:** [April 11, 2006, 6:34pm UTC](https://forum.kirupa.com/t/stopping-a-current-frame/185200/5 "2006-04-11T18:34:18Z")

</div>

That’s because this:  
on(rollOver){  
if (\_root.ALFRED.\_currentframe == “rank1”) {  
root.ALFRED.stop()  
}

is only checking to see if alfred is on that frame at the time of the rollover, it does not continue to check while the mouce is on top of the button. So if alfred is not on that exact frame when you roll over the button, then n othing is going to happen.

That’s why I suggested the other method.

---

<div class="post-metadata">

**Author:** ![Freeseus](https://avatars.discourse-cdn.com/v4/letter/f/9e8a1a/32.png) [@Freeseus](https://forum.kirupa.com/u/Freeseus)\
**Post date:** [April 11, 2006, 6:50pm UTC](https://forum.kirupa.com/t/stopping-a-current-frame/185200/6 "2006-04-11T18:50:08Z")

</div>

> [@kortexvfd](#):
>
> That’s because this:  
> on(rollOver){  
> if (\_root.ALFRED.\_currentframe == “rank1”) {  
> root.ALFRED.stop()  
> }
> 
> is only checking to see if alfred is on that frame at the time of the rollover, it does not continue to check while the mouce is on top of the button. So if alfred is not on that exact frame when you roll over the button, then n othing is going to happen.
> 
> That’s why I suggested the other method.

Got ya. Thanks a bunch guys.
