5 Replies Latest reply on Nov 17, 2010 9:42 AM by the0reticalyield

    How to play a random sound in Flash builder?

    the0reticalyield

      so I have code that plays an mp3 from my sounds file….I want to modify the function (code below) so that it randomly plays one of the mp3 files in the sounds folder instead of a specific mp3 file (as it is set up now)... i ve googled this on the net but to no avail i am really stuck and any help would be appreciated immensely!  Thank you in advance!!!

       

       

      private var soundClip:Sound;

      private var soundClipChannel:SoundChannel;

      protected function play(clip:String):void

      {

      if(soundClipChannel !=null) {

      soundClipChannel.stop();

      }

      soundClip = new Sound(new URLRequest('sounds/' + clip + '.mp3'));

      soundClipChannel = soundClip.play();

      }

       

       

      Also how do i set up linkage? I've read online that my .mp3 files have to have linkage names set up…how do i do this?

       

      I'm new to flash builder and have tried a few approaches needless to say none of them have worked…  : (