Monday, June 15, 2009

SoundManager in as3

On the internet I found a very interesting class. I used it in a project I'm working on right now. It is a singleton class to load library or external sounds. So with some very simple lines of code you can implement and use the sounds.

you can download the class here:
http://evolve.reintroducing.com/2008/07/15/news/as3-soundmanager/

In your flash file you can set a linkage to the sound in your library:


To use the soundmanager simply use these lines:


//load the sound from library
SoundManager.getInstance().addLibrarySound(nl.Amercom.Sounds.MenuItem, "MenuItem");

//play the sound on a rollover or somewhere else
SoundManager.getInstance().playSound("MenuItem");

No comments: