QueueLoader AS3 rev 8

Latest Version Info:
Click here for the current rev

Click here for the usage guide

Click here for the change log

Also click here for any posts related to the latest changes:
QueueLoader Updates

There have been a number of valid requests and great suggestions for enhancement, so I’m inviting help in the hopes of making QueueLoader better and better. Contact me there if you are interested in helping:) I’ve removed the examples thanks to the wordpress update and new editor screwing up the code formatting. I got it under control now, but you can see the example in the source. Download the stable file in the most recent post here, or check out the new features in development on in the svn.

20 Responses to “QueueLoader AS3 rev 8”

  1. » QueueLoader AS3 rev 8 Says:

    [...] You can read the rest of this blog post by going to the original source, here [...]

  2. steven Says:

    Is there a way that the Preloader does this on his own?
    if(event.filetype == QueueLoader.FILE_XML){
    _xml = new XML(event.file);
    }

    so then there would be no need to pass a null Object. Instead the XMLContainer could be passed and directly used when the loading que has finished. I think this would be more usefull.

  3. Justin Winter Says:

    Great work man! Here are a few features that I think would be used a lot.

    pause/resume functions
    reorder function (loadIndex:int)

    Pause/resume are self explanatory, and I fully realize re-ordering could be done with some array manipulation and possibly with sort. That being said, I think the end user would benefit from simplifying the process.

    The user case would be, for example, if you are downloading a queue of images for a slideshow and the user navigates to an image that hasn’t loaded yet using the forward button. Ideally there would be a way to easily pause all loading and reorder the queue to load the current requested image and continue loading the other images in the background.

    If you get the code posted on Google let me know if you’d be interested in getting some help on adding additional features going forward.

    Again, nice work!

  4. djdonovan Says:

    Not currently. One would assume that when the complete is fired within QueueLoader, you can do currItem.targ = new XML(event.target.data) but this doesn’t seem to be affecting the target/container (which is the XML object) on the other side. It’s possible I’m overlooking something though or a break in the data flow to the current target has been broken with another feature.

    But alas! QueueLoader is new open source, and I have added it to googlecode so if anyone is interested in helping, by all means let me know :) I’ve updated the post with the info.

  5. djdonovan Says:

    Yes Justin, that would be great! I updated the post with the google code info.

  6. Justin Winter Says:

    One thing I just noticed is that you aren’t passing the dataObj back with the event. I’m not sure if that was by design or not, but it seems like you would want to pass this object back as it gives the user a nice container to attach variables that will be used later.

    I have the repository checked out, if you can add me as a developer, i’ll add my revisions. I’ll email you directly with my gmail address.

  7. steven Says:

    thx man!!! doing a great job here

  8. djdonovan Says:

    Thanks steven!

  9. tasovi Says:

    Imagine you are loading a swf with your loaderclass. That swf has a documentclass. The documentclass itself has a public function.
    how can I call that public function, after loading the swf into a container with the loaderqueue ?

    thx!

  10. djdonovan Says:

    When setting up a QueueLoader:

    //Definition vars for accessing loaded swf libary classes in this scope
    var addedDefinitions:LoaderContext = new LoaderContext();
    addedDefinitions.applicationDomain = ApplicationDomain.currentDomain;

    // Scope and Instantiate variables
    var _oLoader:QueueLoader = new QueueLoader(false, addedDefinitions);

    And then when the external swf is done loading:

    var SWFClassReference:Class = getDefinitionByName(“SWFClass”) as Class;
    var _oSWFClass:* = new SWFClassReference();
    swfClass.doFunction();

    The example in the source does the same thing but with a Sound Object in the external swf’s library. If you comment the SoundManager control of the sound and uncomment the external swf access of the sound you’ll see it in action.

  11. Manuel Fritsch Says:

    Hi,

    great JOB! - but i have one specific problem: since we use a CMS (Plone/Zope) which doesnt use file extensions, the loader doesn’t work because he can’t assing the file_types at this part i.e.:
    if(currItem.url.match(”.jpg”) != null) _currType = FILE_IMAGE;

    (of course not) - so there should be an option to assign the expected file type at the addItem function for this case. that would be great.

  12. djdonovan Says:

    I’ll include this in the next revision.

  13. Next2Heaven Says:

    Love this loaderQueue…having one issue though. I’m adding a swf to the queue and need to use gotoAndStop on certain frames of the clip. Here is the basic code:

    public var _oLoader:QueueLoader = new QueueLoader();
    public var backTheme:MovieClip = new MovieClip();
    _oLoader.addItem(”assets/backTheme_nature.swf”, backTheme, {title:”Image”});
    addChild(backTheme);

    …later on…
    backtheme.gotoAndStop(”Screen2″);

    This isn’t working. Am I missing something?

  14. djdonovan Says:

    Thanks man!

    backtheme.gotoAndStop() would be accessing the swf’s container.

    To access the actual loaded swf’s timeline you would need to use var mc:MovieClip = event.file; in an onItemInit or onQueueInit handler.

    then you could do mc.gotoAndStop(”label”);

    Let me know if that helps.

  15. Next2Heaven Says:

    Very, very cool. That’s exactly what I needed. Thank you! I’m keeping an eye on this script as it evolves. Makes life lots easier when you have a lot of dynamic content. Thanks again!

  16. tasovi Says:

    I found out, that instead of doing:

    var SWFClassReference:Class = getDefinitionByName(“SWFClass”) as Class;
    var _oSWFClass:* = new SWFClassReference();
    swfClass.doFunction();

    you also do:
    oQueueLoader.addItem(”application.swf”, oApplication, {name:”application”});

    and once it is done loading you can say:
    oApplication = addChild(oEvent.file);
    oApplication.start();

    the good thing is, that you don’t have to know the name of the class that comes with your loaded swf!!!!

  17. tasovi Says:

    or even simpler:
    oApplication = oEvent.file;
    oApplication.start();

  18. Next2Heaven Says:

    One hang up with this is doing multiple swf’s though. When in the INIT function how do you set the right variables like:

    oApplication1 = oEvent.file;
    oApplication2 = oEvent.file;

    See the problem? Could you use an if/then on the ‘name’ variable your attaching to it like:

    if(oApplication1.content.name == “application1″) oApplication1 = oEvent.file;
    …etc?

    The ideas above work great for one swf but 2+ causes issues. Anybody have an idea?

  19. Next2Heaven Says:

    Oh…got it. Just use:

    if(oEvent.name==”application1″) oApplication1 = oEvent.file;

  20. djdonovan Says:

    I’ve posted a stable rev. Some features have been lost to the svn as they need more testing. Go here

Leave a Reply