How do I loop a sound-file using Actionscript 3?

Hey y’all!

I got a little question.

I have a 50 sec sound-file that I want to loop in my Flash application.

Actionscript 3 is what I’m using.

Thanks,

Fred

I’m not 100% sure on how this works in Flash, but the classes should be the same:

import flash.net.URLRequest;
import flash.media.Sound;

var url:URLRequest = new URLRequest("sound.mp3");
var snd:Sound = new Sound(url);
snd.play(0, 0);

The Sound.play method takes three arguments. The first two are 1) start time and 2) loops. If you want to have it loop indefinitely you could create an event listener for when the sound stops and call a function to play the sound again.