Posted By

adrianparr on 04/15/10


Tagged

external load mp3 sound loading as3 URLRequest SoundChannel


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

socialflasher
donaldleegraham
tspitzr
elkraneo


AS3 Loading and Playing an External MP3 File


 / Published in: ActionScript 3
 

  1. import flash.media.Sound;
  2. import flash.media.SoundChannel;
  3. import flash.net.URLRequest;
  4.  
  5. var snd:Sound = new Sound();
  6. var channel:SoundChannel = new SoundChannel();
  7. snd.load(new URLRequest("song.mp3"));
  8. snd.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
  9. function onComplete(evt:Event):void {
  10. channel = snd.play();
  11. }

Report this snippet  

You need to login to post a comment.