Вот с хелпа флеша вырезал(проверено работает как часы):
Код:
// Create a new Sound object to play the sound.
var songTrack:Sound = new Sound();
// Create the polling function that tracks download progress.
// This is the function that is "polled." It checks
// the download progress of the Sound object passed as a reference.
checkProgress = function (soundObj) {
var bytesLoaded = soundObj.getBytesLoaded();
var bytesTotal = soundObj.getBytesTotal();
var percentLoaded = Math.floor(bytesLoaded/bytesTotal * 100);
trace("%" + percentLoaded + " loaded.");
};
// When the file has finished loading, clear the interval polling.
songTrack.onLoad = function () {
clearInterval(poll);
};
// Load streaming MP3 file and start calling checkProgress()
songTrack.loadSound("http://yourserver.com/songs/beethoven.mp3", true);
var poll = setInterval(checkProgress, 1000, songTrack);
Если надо разные подгружать мр3, то делай след:
Код:
myrand=random(5)+1;//это для 5 звуков, т.е. name_[1-5].mp3
songTrack.loadSound("name_" + myrand + ".mp3",true);