# Problem with rollOver/rollOut

**URL:** <https://forum.kirupa.com/t/problem-with-rollover-rollout/259985>\
**Category:** flash\
**Created:** [May 11, 2008, 11:07am UTC](https://forum.kirupa.com/t/problem-with-rollover-rollout/259985 "2008-05-11T11:07:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gacca](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/gacca/32/3936_2.png) [@gacca](https://forum.kirupa.com/u/gacca)\
**Post date:** [May 11, 2008, 11:07am UTC](https://forum.kirupa.com/t/problem-with-rollover-rollout/259985/1 "2008-05-11T11:07:35Z")

</div>

Hi,

I’m hoping that some of you have had the same problem. I have made a MovieClip that acts as button. When user rolls out from it, a sound plays, but the problem is that when I roll over the button, the flash for some unknown reason sometimes starts making multiple rollOvers/rollOuts in quick succession. Anyone know what might be the problem?

Gatis

---

<div class="post-metadata">

**Author:** ![small\_guy](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@small\_guy](https://forum.kirupa.com/u/small_guy)\
**Post date:** [May 11, 2008, 2:18pm UTC](https://forum.kirupa.com/t/problem-with-rollover-rollout/259985/2 "2008-05-11T14:18:18Z")

</div>

On your rollOver even handler add a stopAllSounds();

I assume that your sound is set up as a lingage sound and not something you’ve put on a timeline.

Your whole code might then look something like this:

var my\_sound:Sound = new Sound();  
my\_sound.attachSound(“music”); //or whatever the name is you’ve given it in linkage

//since you want no sounds to be playing on the RollOver action:

movieClip\_btn.onRollOver = function() {  
stopAllSounds();  
}

//since you want the sound to play on the rollOut action:

movieClip\_btn.onRollOut = function() {  
my\_sound.start();  
}

I hope this addresses your question successfully.

[QUOTE=gacca;2324612]Hi,

I’m hoping that some of you have had the same problem. I have made a MovieClip that acts as button. When user rolls out from it, a sound plays, but the problem is that when I roll over the button, the flash for some unknown reason sometimes starts making multiple rollOvers/rollOuts in quick succession. Anyone know what might be the problem?

Gatis[/QUOTE]

---

<div class="post-metadata">

**Author:** ![jitu78](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@jitu78](https://forum.kirupa.com/u/jitu78)\
**Post date:** [May 12, 2008, 7:14am UTC](https://forum.kirupa.com/t/problem-with-rollover-rollout/259985/3 "2008-05-12T07:14:58Z")

</div>

[quote=small\_guy;2324651]On your rollOver even handler add a stopAllSounds();

I assume that your sound is set up as a lingage sound and not something you’ve put on a timeline.

Your whole code might then look something like this:

var my\_sound:Sound = new Sound();  
my\_sound.attachSound(“music”); //or whatever the name is you’ve given it in linkage

//since you want no sounds to be playing on the RollOver action:

movieClip\_btn.onRollOver = function() {  
stopAllSounds();  
}

//since you want the sound to play on the rollOut action:

movieClip\_btn.onRollOut = function() {  
my\_sound.start();  
}

I hope this addresses your question successfully.[/quote]

Hi Small\_guy,

Not seems small at all.

Any way, I’ve one issue with my flash code for music palyer. It’s IE browser issue.  
Please visit [[COLOR=#810081]www.gigaturn.com[/COLOR]](http://www.gigaturn.com/), its my new work.

Go to flash work from top links and check music player.  
There you will see some error/warning in IE, how can I fix it?

Thanks in advance.
