Skip to content

Instantly share code, notes, and snippets.

@hydrotik
Created November 25, 2009 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hydrotik/242829 to your computer and use it in GitHub Desktop.
Save hydrotik/242829 to your computer and use it in GitHub Desktop.
//PCM Wav Loading Example
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
var soundChannel:SoundChannel = new SoundChannel();
var _oLoader:QueueLoader = new QueueLoader();
_oLoader.addItem("../flashassets/pcm/loop1.wav", null, {title:"Loop1"});
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
_oLoader.execute();
function onQueueProgress(event:QueueLoaderEvent):void {
trace("\t>>onQueueProgress: "+event.queuepercentage);
}
function onItemComplete(event:QueueLoaderEvent):void {
trace("\t>> "+event.type, "item title: "+event.title);
if (event.fileType == QueueLoader.FILE_WAV) {
soundChannel = event.content.play(0,999);
}
}
function onQueueComplete(event:QueueLoaderEvent):void {
trace("** "+event.type);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment