Add

QueueLoaderLite


QueueLoaderLite has been deprecated. Regular QueueLoader 3.1.7 and later can be made into a lite version by removing loadable items!

I've stripped down some of the heavier features for an alternate "lite" version for those wishing a bare bones QueueLoader with low file size. QueueLoader will continue to thrive and there are some enhancements to the regular version that will be made shortly.

The lite version is focused exclusively on image and swf asset loading. Application Domain/Loader Context is still there so you can load other items within a swf and have access to its class references in the library. I will add another guide page on the Google page shortly. I'm including all the listening function in the example below just so you can see it in action, but any/all of them can be removed. More examples and documentation on this version to come, but in the meantime… Basic usage:

import com.hydrotik.utils.QueueLoaderLite;
import com.hydrotik.utils.QueueLoaderLiteEvent;
 
 
 
 
var qlLoader:QueueLoaderLite = new QueueLoaderLite();
 
var imageContainer:Sprite = new Sprite();
addChild(imageContainer);
imageContainer.name = "image";
 
qlLoader.addItem("../flashassets/images/slideshow/1.jpg", imageContainer, {title:"image"});
 
qlLoader.addEventListener(QueueLoaderLiteEvent.QUEUE_START, onQueueStart, false, 0, true);
qlLoader.addEventListener(QueueLoaderLiteEvent.ITEM_START, onItemStart, false, 0, true);
qlLoader.addEventListener(QueueLoaderLiteEvent.ITEM_PROGRESS, onItemProgress, false, 0, true);
qlLoader.addEventListener(QueueLoaderLiteEvent.ITEM_COMPLETE, onItemComplete, false, 0, true);
qlLoader.addEventListener(QueueLoaderLiteEvent.ITEM_ERROR, onItemError, false, 0, true);
qlLoader.addEventListener(QueueLoaderLiteEvent.QUEUE_PROGRESS, onQueueProgress, false, 0, true);
qlLoader.addEventListener(QueueLoaderLiteEvent.QUEUE_COMPLETE, onQueueComplete, false, 0, true);
 
qlLoader.execute();
 
function onQueueStart(event : QueueLoaderLiteEvent):void {
        trace("** "+event.type);
}
 
function onItemStart(event : QueueLoaderLiteEvent):void {
        trace(">> "+event.type, "item title: "+event.title);
}
 
function onItemProgress(event : QueueLoaderLiteEvent):void {
        trace("\t>> "+event.type+": "+[" percentage: "+event.percentage]);
}
 
function onItemComplete(event : QueueLoaderLiteEvent):void {
        trace(">> name: "+event.title + " event:" + event.type+" - "+["target: "+event.targ, "w: "+event.width, "h: "+event.height]+"\n");
 
}
 
function onItemError(event : QueueLoaderLiteEvent):void {
        trace(">> name: "+event.title + " event:" + event);
}
 
function onQueueProgress(event : QueueLoaderLiteEvent):void {
        trace("\t>> "+event.type+": "+[" queuepercentage: "+event.queuepercentage]);
}
 
function onQueueComplete(event : QueueLoaderLiteEvent):void {
        trace("** " + event.type);
}

And for instantiating library assets in an external swf library:

import com.hydrotik.utils.QueueLoaderLite;
import com.hydrotik.utils.QueueLoaderEventLite;
 
var addedDefinitions:LoaderContext = new LoaderContext();
addedDefinitions.applicationDomain = ApplicationDomain.currentDomain;
 
var qlLoader:QueueLoaderLite = new QueueLoaderLite(false, addedDefinitions);
 
var soundSWF = new MovieClip();
soundSWF.name = "externalSounds";
addChild(soundSWF);
 
var soundChannel:SoundChannel = new SoundChannel();
 
qlLoader.addItem(prefix("") + "flashassets/swf/externalsounds.swf", soundSWF});
qlLoader.addEventListener(QueueLoaderLiteEvent.QUEUE_COMPLETE, onQueueComplete,false, 0, true);
qlLoader.execute();
 
 
function onQueueComplete(event:QueueLoaderLiteEvent):void {
        trace("** "+event.type);
        var Loop1Reference:Class = getDefinitionByName("Loop1") as Class;
        var loop1:Sound = new Loop1Reference();
        soundChannel = loop1.play();
}

QueueLoaderLite Source

The Discussion

see what everyone is saying

  • am March 22nd, 2008 at 11:07 am #1

    hi Donovan,

    first of all thanks for the work you are putting here, great classes. I found your page when searching for a class that would help me out dealing with loading images. And seams i've found the place. I'm having some difficulties when using the provided code, I'm working in timeline, so just copied the code and it throws some errors:

    1067: Implicit coercion of a value of type flash.display:Sprite to an unrelated type Class.

  • djdonovan March 22nd, 2008 at 1:18 pm #2

    Thanks. I forgot to add the string variable for the image path. I updated the post. Where it said pt, you would add a sting path to your asset.

  • am March 22nd, 2008 at 3:07 pm #3

    so i've write a comment with too much charaters :p
    … just realise now. any ideias how can I write some more lines?!… cause still have some doubts I'd love to share with you :P

    thanks

  • djdonovan March 23rd, 2008 at 6:06 pm #4

    Updated the example.

  • Alex April 30th, 2008 at 4:33 pm #5

    Hi…
    Quick question…how would I get the "queuepercentage" value from the AS2 version of QueueLoader? It has the event onQueueProgress, but I don't see the queuepercentage property.

    Thanks for moving this to AS3. I use it all the time, but now need to go back to AS2 and never ran into this.

  • djdonovan April 30th, 2008 at 5:09 pm #6

    I didn't do the AS2 version, but as far as I know it doesn't support an overall monitoring percentage.

  • Matt May 1st, 2008 at 2:18 pm #7

    I have a little problem.
    I'm loading a group of images and want to position them on the go, but if I try to get domensions of an mc:

    function onItemComplete(event:QueueLoaderLiteEvent):void {
    trace(img.width);
    }

    The function returns the dimensions only when the last onItemComplete is fired and returns 0 for every item before.
    How can I position items while loading them ?

  • djdonovan May 1st, 2008 at 2:45 pm #8

    event.width and event.height will access the properties when the item has completed loading.

  • Matt May 1st, 2008 at 6:44 pm #9

    Thanks man, I've already done it by getting dimensions of a previous image in onItemStart but this is even easier.

    I've got another problem now,
    when I test the movie in Flash all event functions are fired but if I either simulate download or open the file in a browser only the first 'onItemStart' and 'onItemProgress' are fired. The first onItemComplete and the other functions (for next items) are never called although files are loaded one after another.

    How to solve this ? What could I do wrongly ?

  • soenke May 4th, 2008 at 7:51 pm #10

    Hi, greate work, but there is one thing you have to fix:
    while checking the filetype you dont check filetypes in uppercase. you should:
    if(String(currItem.url).toLocaleLowerCase().match(".jpg") != null) _currType = FILE_IMAGE;

    if you don't – files saved in uppercase are not loaded – and worse than that: the loading queue stops completely

  • alan June 27th, 2008 at 6:41 am #11

    hi .. first of all .. thanks for this great piece of code!

    i have a question .. is there a way to pause the queue and then resume it? if yes, then i would appreciate a for some help how to do it.

    thanks again
    bests
    alan

  • djdonovan June 27th, 2008 at 1:24 pm #12

    Not with QueueLoaderLite, but this should work with QueueLoader. download the latest from the SVN

    http://code.google.com/p/queueloader-as3/

    I'll try and upload the file here as well on the google code download site.. was giving me problems when I tried to update last time.

  • Fintan Boyle July 8th, 2008 at 3:48 pm #13

    great resource. I needed this for an AS2 project and made an AS2 version available on my blog:

    http://fboyle.com/blog/?p=17

    not as feature rich but it may be useful none-the-less:)

    -Individual monitoring
    -Overall queue monitoring
    -Image loading
    -SWF loading
    -MP3 loading

  • djdonovan July 8th, 2008 at 5:48 pm #14

    QueueLoader for AS3 was actually based on a class that was already written for AS2. Didn't have as many features, but might have saved you a little trouble:)

    http://www.betriebsraum.de/blog/downloads/

  • Fintan Boyle July 9th, 2008 at 1:34 am #15

    …but then I wouldn't have learnt anything ;-)

  • djdonovan August 7th, 2008 at 6:02 am #16

    Updates have been posted to the SVN.

  • Eric September 16th, 2008 at 1:03 pm #17

    I'm sorry… This is probably super stupid but I can't figure it out! When I try to compile the example on this page using FlashDevelop I get: "Error: Type was not found or was not a compile-time constant: QueueLoaderLiteEvent." for every listener function. I'm importing both QueueLoaderLite and QueueLoaderLiteEvent. What am I missing?

  • djdonovan September 16th, 2008 at 5:10 pm #18

    Sounds like something isn't getting imported. Can you past your code sample or better yet send it to me?

  • Gilles October 3rd, 2008 at 9:19 am #19

    Hi Donovan

    And thank you for this cool tool. I get a weird error though: every item gets loaded but events stop fireing after the first item has loaded…
    Do you have some clue ?

  • djdonovan October 3rd, 2008 at 10:06 am #20

    I'd have to see the code. This is an old post, make sure you are using the latest version from googlecode svn. If you want to post a snippet I can have a look.

  • Jason October 6th, 2008 at 7:25 am #21

    Hi Donovan,

    Question for you. I'm using your QueueLoaderLite for a project. Works great, but I'm having a little trouble accessing the loaded SWFs, all of which have a function in them that I'd like to call before adding anything to the stage. Works with the Loader class – during the onComplete event I can use var mc:MovieClip = event.currentTarget.content as MovieClip; and then call the funtion mc.functionName(); In QueueLoaderLite i pass a MovieClip reference during the addItem call, but I can't seem to get at my functions within that MC or the QueueLoaderLiteEvent's event.targ MC.

    Any suggestions would be much appreciated.

  • djdonovan October 6th, 2008 at 5:04 pm #22

    event.file.yourFunction();

  • Kirit Tanna October 27th, 2008 at 2:39 am #23

    QueueLoaderLite's dispose() method doesn't remove the internally registered listeners. As a result, if we attempt to call dispose() while the queue hasn't completed these handlers get triggered especially "onQueueComplete" and will throw a run-time error.

    Example: Images are being loaded into a "gallery" page, user moves to another page "about us" (developer calls dispose) while images in the gallery have yet not completely loading before loading the new page.

  • djdonovan October 27th, 2008 at 1:56 pm #24

    Thanks for the catch, I've updated the SVN to QueueLoaderLite rev11.

  • Ustir May 1st, 2009 at 12:07 am #25

    Thank you donovan for this Lite version, it saves a lot of k's. On referencing loaded movie clips, is there a way like in QueueLoader to get "getItemByTitle" as in…"loader.getItemByTitle("mc_name)"?

    event.file.yourFunction(); works fine if you need to perform some kind of action immediately onItemComplete but after everything's loaded, what if i wanted to fade up/down clips say on nav click change? i.e. what is a way to keep refences to the multiple clip instances? one way is to put them into an array i suppose. any suggestions from anyone who's figured out some work around would be appreciated! thanks.

  • djdonovan May 1st, 2009 at 10:27 am #26

    Nope, there isn't as of yet. I'd suggest using the regular version as the size isn't too much larger. And you can always remove some of the mime types to scale it down. Should be instructions on the QL version or in this post. If you have any problems, let me know and I can explain how.

    Cheers

  • Ustir May 2nd, 2009 at 11:36 pm #27

    hi donovan, thanks for your response, i will look into remove some mime types to reduce the foot print.

Respond

get in on the action.

* Required

  • Viagra ordre
  • Cialis en ligne
  • Levitra en ligne
  • Propecia acheter
  • Viagra acheter
  • Acheter cialis
  • Ordre levitra
  • Ordre propecia
  • En ligne viagra
  • Vente cialis
  • Levitra bon marche
  • Propecia en ligne
  • Viagra online
  • Buy cialis
  • Order Levitra
  • Buy propecia
  • Buy viagra
  • Cheap cialis
  • Cheap Levitra
  • propecia online
  • Viagra prescription
  • Cialis online
  • Buy Levitra
  • Order propecia