# Button with sound

**URL:** <https://forum.kirupa.com/t/button-with-sound/202525>\
**Category:** flash\
**Created:** [October 2, 2006, 2:13pm UTC](https://forum.kirupa.com/t/button-with-sound/202525 "2006-10-02T14:13:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![o111](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/o111/32/2123_2.png) [@o111](https://forum.kirupa.com/u/o111)\
**Post date:** [October 2, 2006, 2:13pm UTC](https://forum.kirupa.com/t/button-with-sound/202525/1 "2006-10-02T14:13:22Z")

</div>

I’ve made a mc button with this script on frame 1 inside the button:

```auto
stop();
 
this.onEnterFrame = function(){

if(rewind == true){

prevFrame();

}

}
 
this.onRollOver = function(){

rewind = false;
play();

}
 
this.onRollOut = function(){

rewind = true;

} 

```

And I want to put some sound on my button. But if I add sound to, lets say frame 2 inside the mc, the sound plays when I roll over the button, and also when I roll out. And that is because of the script I have that let’s it rewind. But I only want to have sound on when you roll over the button, not when you roll out of it too…

I guess I can put some code on the mc itself, and export the sound to actionscript from the library. But I still don’t know what code to put on the button. I tried something like this:

```auto
on (rollOver) {
    new Sound("buttonsound");
    
}

```

But it didn’t work:P So what code do I need on the button, to load the sound from the library and to the button… when I roll over!? 🙂

peace:D
