A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Play MP3 on rollover

  1. #1
    Junior Member
    Join Date
    Feb 2011
    Posts
    2

    Play MP3 on rollover

    Greetings,

    First I'd like to say thanks for this great forum.

    I've got a simple rotating banner and would like to have an mp3 play if someone rolls over the banner and stop if they move their mouse away.

    I grabbed some code from this forum and placed it on my button instance but it's not working.

    Here are the working files:

    http://www.4shared.com/file/I2STw9Eo/gh_online.html

    I've "linked" the mp3 file and given it the ID of "makin" and posted the following actionscript on the button instance:

    Actionscript Code:
    // button actions
    on (rollOver){
    // creates a new object from Sound class
    yourSound = new Sound();
    // attach the 'idSound' named from library
    yourSound.attachSound("makin");
    // start the sound attached
    yourSound.start(0,1);
    }
    on (rollOut){
    yourSound.stop();
    }

    Any help would be greatly appreciated.

    Thanks

  2. #2
    Junior Member
    Join Date
    Feb 2011
    Posts
    2
    Sorry - that link is missing one of the files. Here's the completed FLA and mp3

    http://www.4shared.com/file/szB6OiYc/gh_2.html

  3. #3
    Senior Member hts5000's Avatar
    Join Date
    Oct 2007
    Posts
    160
    That code seems to work fine for me. Try starting a new file altogether with just a button and the .mp3. This way you can tell if its the code (which i don't think it is), or something else.
    Last edited by hts5000; 02-04-2011 at 08:54 AM. Reason: wrong answer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center