Posted By

visualadvance on 01/23/10


Tagged

actionscript sound 3 as3 SoundChannel


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

adrianparr
tspitzr


AS3: playSound


 / Published in: ActionScript 3
 

A simple way to play sounds that are exported from your library

  1. // this is the clip you export from your library
  2. private var sndRollover:Rollover = new Rollover;
  3.  
  4. // define a sound channel to play it in
  5. private var sndChannel:SoundChannel = new SoundChannel ();
  6.  
  7. public function playSound (soundName:Object):void
  8. {
  9. sndChannel = soundName.play (0, 1);
  10. }
  11.  
  12. // just call playSound and the name of the sound you defined at the top
  13. // playSound (sndRollover);

Report this snippet  

You need to login to post a comment.