QueueLoader AS3 Update
Latest Version Info:
Click here for the current rev
Click here for the usage guide
Also click here for any posts related to the latest changes:
QueueLoader Updates
I made a significant and minor fix to the QueueLoader class.
There was a dupe event being dispatched for complete and init that was dispatching ITEM_INIT twice. My apologies for that.
I also changed the {name:”Image 1″} to reflect the custom event so it is now {title:”Image 1″}
Update
In response to Erik’s question; I’m assuming you are referring to swf files as an alternate file type? FLV files and Audio files would be a nice addition of functionality to the class for loading into your assets library. However in the meantime, you can load swf files using QueueLoader as it is. It’s a little convoluted but here’s how to do it:
Here’s a snippet of code to add the swf to the loading queue as well as it’s respective container, in this case using the MovieClip class.
swf.name = “swf”;
addChild(swf);
_oLoader.addItem(prefix(“”) + “flashassets/images/slideshow/WCS.swf”, swf, {title:“swf”});
In the listening functions we add some code to detect the MovieClip container and access the timeline in it’s target.
if(event.targ is MovieClip){
var container:MovieClip = event.targ as MovieClip;
var loader:Loader = container.getChildAt(0) as Loader;
var clip:MovieClip = loader.content as MovieClip;
clip.gotoAndPlay(2);
}
}
The above snippet is from an example that loads images and then loads a swf. The external swf has a stop() command in its first frame. The above snippet is in the ITEM_INIT handler and plays the swf’s timeline once it’s loaded. Although from a practical standpoint you would assign the clip to a class variable and then do the gotoAndPlay command in the QUEUE_INIT handler once everything is done loading.
Something interesting I noted here as well. Might be worthy of a post on it’s own. If you simply “type” the above variables with their respective classes you will get a coercion error, whereas declaring them makes it work fine. I’m assuming this is because the event.targ variable returns a DisplayObject. I’ve already changed the DisplayObject to “*” in rev 3.0.6 but it still requires the “variable as Class”. I’ll post that code when I make some more progress.
So to sum it up: The above example is a bit of a hack for the time being. I will add a more direct method for accessing the timeline of a loaded swf as well as an event variable that specifies the content type in the not so distant future:) Beyond that I will look into the feasibility of loading external mp3 files, flv files, and zip files.
A more recent version of this code has been posted! Go HERE
September 13th, 2007 at 3:05 am
Hi Donovan,
thanks again for this nice working class. I just noticed the problems with the previous version and did some workarounds. What about preloading other filetypes than images? Would be really great!
October 30th, 2007 at 11:44 am
I’ve posted updates to QueueLoader here.