Created
November 25, 2009 16:16
-
-
Save djdonovan/242823 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sorting Example | |
import com.hydrotik.queueloader.QueueLoader; | |
import com.hydrotik.queueloader.QueueLoaderEvent; | |
var _oLoader:QueueLoader = new QueueLoader(); | |
_oLoader.addItem("../flashassets/mp3/GetDown.mp3", null, {title:"MP3"}); | |
_oLoader.addItem("../flashassets/swf/externalsounds.swf", this, {title:"SWF"}); | |
_oLoader.addItem("../includes/admin/test.xml", null, {title:"XML"}); | |
_oLoader.addItem("../includes/admin/data.php?id=1&user=yourname", null, | |
{title:"XML PHP", mimeType:QueueLoader.FILE_XML} | |
); | |
_oLoader.addItem("../flashassets/swf/externalimages.swf", null, {title:"SWF Images", drawFrames:true}); | |
_oLoader.addItem("../includes/admin/test.css", null, {title:"CSS"}); | |
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_START, onQueueStart, false, 0, true); | |
_oLoader.addEventListener(QueueLoaderEvent.ITEM_COMPLETE, onItemComplete,false, 0, true); | |
_oLoader.addEventListener(QueueLoaderEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true); | |
_oLoader.execute(); | |
function onQueueStart(event:QueueLoaderEvent):void { | |
trace("** "+event.type); | |
trace(_oLoader.getQueuedItems()); | |
} | |
function onItemComplete(event:QueueLoaderEvent):void { | |
trace("\t>> "+event.type, "item title: "+event.title); | |
if (event.title == "MP3") { | |
// This takes an array of two items (second arg) | |
// from 4th position (1st arg) and inserts them | |
// into the 2nd position (3rd arg) | |
_oLoader.shuffle(4, 2, 2); | |
} | |
} | |
function onQueueComplete(event:QueueLoaderEvent):void { | |
trace("** "+event.type); | |
trace(_oLoader.getLoadedItems()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment