Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save djdonovan/242809 to your computer and use it in GitHub Desktop.

Select an option

Save djdonovan/242809 to your computer and use it in GitHub Desktop.
// Calling a SWF's Library Class References - Application Domain Example
import com.hydrotik.queueloader.QueueLoader;
import com.hydrotik.queueloader.QueueLoaderEvent;
var addedDefinitions:LoaderContext = new LoaderContext();
addedDefinitions.applicationDomain = ApplicationDomain.currentDomain;
var _oLoader:QueueLoader = new QueueLoader(false, addedDefinitions, true, "testQueue");
_oLoader.addItem("../flashassets/swf/externalsounds.swf", this, {title:"SWF"});
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_START, onQueueStart, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
_oLoader.execute();
//Listener functions
function onQueueStart(event:QueueLoaderEvent):void {
trace("** "+event.type);
}
function onQueueProgress(event:QueueLoaderEvent):void {
trace("\t>>onQueueProgress: "+event.queuepercentage);
}
function onQueueComplete(event:QueueLoaderEvent):void {
trace("** "+event.type);
var loop:Sound = new (getDefinitionByName("Loop1"))();
var soundChannel:SoundChannel = loop.play(0,999);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment