Button with sound

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

this.onEnterFrame = function(){

if(rewind == true){



this.onRollOver = function(){

rewind = false;

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:

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!? :slight_smile: