dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Serving up Sound!!

  1. #1

    Serving up Sound!!

    I'm trying to find the best way to load all the sounds that will play in my flash movie.
    Does anyone have any suggestions??

    I'm fairly familiar with actionscripting, but I have never worked with sound before.

    There are many (13) sound effects in this movie that need to start playing at particular times in the movie to go with the animation.

    Some sounds are on buttons, others need to play on certain frames, and one needs to loop.

    Please help me.

  2. #2
    Senior Member
    Join Date
    Jul 2003
    Location
    Reading, UK
    Posts
    149
    well mr bumblypants,

    you don't say which version of flash you have but...

    I'd declare all the sounds you need as 'sound objects' because this gives you more control.

    to do that:

    1. right click the sounds in the library
    2. choose 'linkage' from the menu
    3. check "export for actionscript"
    4. give your sound a name in the box (a default will be provided)
    5. lets say I've given a sound of mine the linkage name of "boing". So on the first frame of the root layer of my movie, I would declare the sounds like this:

    mysound = new Sound();
    mysound.attachSound("boing")

    Then to start the sound at the appropriate place I would put this code:

    This would make it play once.

    mysound.start();

    For a loop:

    mysound.start(0,999);

    on a button:

    on(release){
    mysound.start();
    }

    Don't forget. If you've declared all your sounds on the _root layer but you want them to play from somewhere else, you need to target the sound properly.

    Lastly, this board taught me everything I know about sound:
    flashkit sound board

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