Loading Reloaded

Announcing BulkLoader an As3 library for multiple loadings / preloadings.

Controlling loading is tedious, error prone, and each projects has such specific requirements that you end up rewriting loading code. A lot. In my last project I spent 4 hours debugging download code and promised my self I would solve this annoyance once and for all. So in the best "let me be lazy" fashion, I decided to write my final loading code.

Everybody has been there, and there are many classes around to manage loading, but I've never found one that was complete, flexible and easy enough to use. AS3 has created some kind of loading hell: so many classes to import and understand, a plethora of listeners, the need for error handling and the new API objects (Bitmap, DisplayObject) have added more corner cases to remember. Worse still, videos are still left in some twisted logic maze.

BulkLoader is my shot at trying to unify the most common cases for loading management into a reusable library for AS3.

It is licensed under an open source MIT license. Features:

  • Unified interface for different loading types.
  • Unified progress notification.
  • Events for individual items and as a group.
  • Priority.
  • Stop,resuming and removing individually as well as in bulk.
  • Configurable number of maximum connections.
  • Cache managing.
  • Statistics about loading (latency, speed, average speed).
  • Multiple kinds on progress indication: ratio (items loaded / items to load), bytes, and weighted percentage.
  • Multiple number of retries.
  • Configurable logging.
  • Video: meta data storage, streaming as soon as connection is open, sane progress handling.
  • Helpers for different kinds of contents
  • Easy memory management (releasing objects)
  • Connection pooling.

Design goals:

  • Minimal imports.
  • Few method to learn.
  • Dynamic nature: items can be added by specifying a url as a String or a URLRequest .
  • Items can be assigned an identifier key to be used on retrieval.

At a glance:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
var loader : BulkLoader = new BulkLoader("main");
loader.add("bg.jpg");
loader.add("config.xml");
loader.add("soundtrack.mp3");
loader.add("intro.flv");
loader.addEventListener(BulkLoader.PROGRESS, onProgress);
loader.addEventListener(BulkLoader.COMPLETE, onComplete);
loader.start();

function onProgress(evt : BulkProgressEvent) : void{
    trace(evt.percentLoaded);
}

function onComplete(evt : Event) : void{
    var bgBitmap = loader.getBitmap("bg.jpg");
    addChild(bgBitmap);
    var video : Video = new Video();
    video.attachNetStream(loader.getNetStream("intro.flv"));
    parseConfig(loader.getXML("config.xml"));
}
The above code in 8 lines:

  • adds 4 items with different typed to be loaded: xml, mp3, flv, jpg.
  • created listeners for progress notification and when all items are done.

I needed a class that:

  • Would wrap up errors elegantly: retries and no errors on browser tabs closed.
  • Progress that works with many simultaneous items and many simultaneous items of very different sizes
  • Would let me use (and let me know) as each item was ready, and would allow items that can be streamed (video, sound) to be consumed as soon as possible.
  • Would treat video as any kind of asset.

I am pretty happy with the results. I feel BulkLoader strikes a good balance between ease of use, flexibility and power. At work we've used it in a few projects, and users like it.

The thought of managing multiple loadings by hand again makes me shiver. It's the same feeling I got when I started to use a tweening library.

The project is hosted at github. Right now, I believe it's very close the final API. Mostly bug fixes and other enhancements.

Links:

Thanks to:

  • Igor Almeida: my coworker who has been a thorough beta tester. A couple of months ago he wrote a loading manager class that, while has little resemblance to BulkLoader, provided many insights and a good road map of what works (and what doesn't). Igor reported bugs and gave a lot of feedback on features and ideais.
  • Zeh: in long emails Zeh has given valuable ideas and discussed a few key issues. Having Zeh give you design ideas is (to steal a phrase from Paul Graham) like having Mick Jagger playing on your son's Bar Mitzvah.'

getting a third opinion

1.
ifunk says at

Yay! This class is awesome. Thanks heaps for sharing it.

2.
felix says at

looks very useful. cheers!

3.
paddy says at

v handy, I'm dealing with a priority loading feature right now ;) I'll look at using it... thanks a mill ;)

4.
zedia.net says at

I have been looking for a class like this for a long time

5.
Mr.doob says at

Looks amazing! Thanks!

But what if you have to load 2 files with the same filename but from two different folders?

Shouldn't it be better something like this: loader.getBitmap("/folder?/bg.jpg");

6.
Mr.doob says at

Ah! I see, you can define IDs for each item. Was a silly question then :P

7.
Arthur Debert says at

Hi Folks,

Thanks for the good words.

Doob: I didn't make myself very clear, but you can specify urls as you see fit:

   loader.add("level1/bg.jpg");
   loader.add("level2/bg.jpg");
   loader.add("");
   
Of, course using different id's will make your life easier. You only have to watch out if you have the same urls being used as POST requests, since those will look like the same. Then you can either use different id's or pass a URLRequest object directly and store it so it can be used to fetch the loaded content.

Cheers

8.
paddy says at

any chance u can make the LoadItem.type propery public? or have a method along the lines of loaderInstance.getContentType()...

i.e i have a use case where an asset is loaded from an xml file. I don't know if it's a swf/jpg/png.... seeing as your class is already figuring it out, it would be handy to have access to it without having to loop through a list of file types again... p;)

9.
Admin says at

Thanks, great loader. We did add it in our bookmarks.

10.
Brian McBride says at

Thanks for the public contribution!

Just this morning I was converting my queue loader to AS3 and I was thinking how I really need to have it support more media types for my sanity, and now I can move on to the more fun parts of development. Thanks a lot.

Quick question, I assume you can change the loading priority if needed mid-stream? And with that, does AS3 handle stopping a load better than AS2? AS2 would drive me nuts when stopping a load only to have the engine keep loading the .swf. Of course, the engine would not display it, as all references would be removed. Still, it kept eating bandwith.

11.
Arthur Debert says at

Folks, I'd ask using the google's for suggestions and feature requests, just so that they don't get lost, but they're dutifully noted.

: This seems like a good idea. Thanks

McBride: As3 is capable of actually closing the connection, thus freeing bandwidth, which is great. Currently changing an item's priority mid flight would reflect on the queue on the next available connection, but wouldn't close a loading operation in place.

12.
Ryan says at

Thanks for sharing this is a great kit. Really useful and able to plug into many loading scenarios where multiple versions might be used on different levels of a map for instance. Right now these can be somewhat of a pain when it is done differently by everyone.

13.
Pete says at

This is really good. Thanks!

14.
Jaza says at

Nice. Very nice.

But I am missing something. Can u track load progress for individual item?

15.
P. says at

This is great.

It would be nice if the LoadingItem stored a ref to the bulkLoader that contained it. This would allow eg. a thumbnail gallery to use myLoadingItem.bulkloader.getBitmap("id") when a LoadingItem it has been tracking is complete without it needing to store a ref to the bulkLoader or get a ref using its static methods.

16.
JP says at

That's great! For sure I will use this class. Thanks for sharing.

17.
Arthur Debert says at

:

Sure can, the , or the short story:

   // get progress for main video only:
   loader.get("my_video.flv").addEventListener("onProgress", onVideoProgress);
   

For a variety of reasons (mostly memory management) I work hard not to expose LoadingItem instances too much. The way to get a handle of a BulkLoader instance is:

   var loader : BulkLoader = new BulkLoader("main-site");
   // later anywhere on your code you can fetch
   // a reference to this BulkLoader instance 
   // using the static function BulkLoader,getLoader:
   var loader : BulkLoader =  BulkLoader.getLoader("main-site");
   

18.
P. says at

Hi,

Yeah. Can see why you have done it. I'm just not a fan of static access. Something just feels wrong if components need to access the BulkLoader like that, but damned if I can think of a better way of doing it.

This is really nicely put together, so thanks a lot.

19.
cksachdev says at

Hi .. API is cool ... But I din found ApplicatoinDomain settings for loading external swf file and getting classes from it.. Is it there ?

20.
Patrick says at

I was having a heck of a time trying to track several items in a loader using a single onProgress function. In that function, I could not get the evt.target.id to show the proper id of the current item, it was always null. Finally figured it out: within the LoadingItem.as file, I changed "internal var id : String;" to "public var id : String;" and it now reports the id correctly in the function. Wee!

21.
tasovi says at

It would be great, if it would be possible, to get a list with all registered IDs

22.
Arthur Debert says at

@ cksachdev Yup there is, just pass a LoaderContext to the props parameter, such as:

loader.add("some.swf", {context:myLoaderContext}

: This is fixed in the newest revision, now the id property of LoadingItems is public.

: This is a great suggestion, I just to think the interface throughly, stay tuned.

23.
BFS says at

Hey great job with this class, very usefull!

I was wondering if you have any sample files showing some basic usage?... In your download zip the examples folder there is nothing. (I was having a couple of issues with an error while trying your code post above so I was hoping to see a working example to see where i'm going wrong)

24.
Arthur Debert says at

:

An exmple fla in is the works, but untill that is ready there are snippets that illustrate very basic usage:

  • the has more detailed usage.
25.
Dominic says at

Hey Arthur, great work!

I want to use this package, but it throws an Exception.

German Error Message: TypeError: Error #1034: Typumwandlung fehlgeschlagen: flash.events::IOErrorEvent kann nicht in br.com.stimuli.loading.BulkErrorEvent umgewandelt werden. at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at

flash.net::URLLoader/flash.net:URLLoader::redirectEvent()

It says that its not able to convert the Event-Object to an BulkErrrorEvent-Object.

Do you have an idea on this?

26.
flayoo says at

BulkLoader doesn´t work with FDT 3 :(

27.
Arthur Debert says at

: I believe this issue was fixed in reviision 65, can you download the latest version and try with that one?

: What doesn't work means? You get compile errors ? Where? If you post more info, I'll fix this asap

28.
BFS says at

Definitly looking forward to an fls example

So when i paste in a simplified variation of your above sample code to load a jpg i keep getting this error:

1046: Type was not found or was not a compile-time constant: BulkProgressEvent.

29.
Daniel says at

Excellent! Simple and powerful :D

30.
Jens Franke says at

Hej,

first of all. Thanks for that excellent package. Really great work.

I also have some problems with the Bulk-Loader an FDT 3. It's seams so that FDT coudn't parse the LoadingItem correctly.

I upload some screenshot: http://exchange.jensfranke.com/bulk_loader_error.png

31.
Arthur Debert says at

It's better to post this on the projects bug tracker at google code, so it doesn't get lost. I've created a and will be tracking this shortly. Thanks for the report.

32.
Arthur Debert says at

It's better to post this on the projects bug tracker at google code, so it doesn't get lost. I've created a and will be tracking this shortly. Thanks for the report.

: You right. I want to prepare some full fledge examples and plan to upload them shortly.

33.
Dominic Graefen says at

Thx. I thought i was having the newest one, but now it works fine.

I've got a little question: I'am preloading my contents in the queue. Is there an easy way to change an LoadingItems priority?

Or do I need to remove the item and add it again with the highest priority?

34.
Arthur Debert says at

Hi folks.

I've been receiving a lot of interesting feedback and I've had some interesting email exchanges regarding feature requests and design decision, and I thought it would be nice if those discussions were public (this blog entry is becoming unwieldy too).

@ Dominic:

35.
Junio Vitorino says at

Hi Arthur Debert, firstly i'd like congratulate you by the excellent work realized in gringo and by this project now. I tried run a example with BulkLoader and i not had success. I get the error message with BulkProgressEvent, look.

1046: Type was not found or was not a compile-time constant: BulkProgressEvent.

The source was created with base in the documentation from svn.

36.
matt says at

Hi, I am using BulkLoader but have a problem in IE. I am loading an image like so...

_bulkLoader.add(url); bulkLoader.get(url).addEventListener(Event.COMPLETE, onImageLoaded); bulkLoader.start();

the complete event fires, but the bitmap object is always null for the first few tries:(

works fine in fire fox

cheers

MaTT

37.
Arthur Debert says at

Hi Matt.

I've been using BulkLoader on I.E. without any issues, so I think I need a bit more information on this:

    • Which version of i.e ?
    • Can you provide a sample of the code you are working with?

As a general note, this is not be best place for bug reports or questions.

I've setup a exactly for that , so it's easier to follow. I'd ask to post questions over there.

Thanks Arthur

38.
Junio Vitorino says at

Cool, now worked here. I did a preloader for listen the BulkLoladerProgressEvent, and work like a charm.

Thanks Arthur, BulkLoader now do part of my personal class package .

39.
Matus Laco says at

Great Class, thanks a lot!

40.
Helmut Granda says at

Hi Matt, Thanks for this great class, I am running in a small dilema and that has to do with assigning the same loaded file to different elements, for example

var tire1Bitmap = loader.getBitmap("tire.jpg"); var tire2Bitmap = loader.getBitmap("tire.jpg"); var tire3Bitmap = loader.getBitmap("tire.jpg"); var tire4Bitmap = loader.getBitmap("tire.jpg");

addChild(tire1); addChild(tire2); addChild(tire3); addChild(tire4);

only "tire4" will display the image... I know i could load the same item 4 times or maybe I need to create an actual movieclip in the library add the element to that library element and then duplicate it....

Any other shortcuts or ideas?

41.
Helmut Granda says at

A correction to my previous post.. the creator's name of the Class is Arthur not Matt.... Sorry about that.

42.
Andres Alva says at

Helmut,

You need to make copies of the Bitmap in order to add them to different DisplayObjectContainers. Here's how you do that.

var tireMainBitmap = loader.getBitmap('tire.jpg'); var tire1Bitmap = new Bitmap(tireMainBitmap.bitmapData.clone()); var tire2Bitmap = new Bitmap(tireMainBitmap.bitmapData.clone());

43.
tbm says at

dude your a legend.. this is just what I needed.

44.
Olaf Tietze says at

Just came stumbling over these loader classes. I just didn't want to write yet another preloading package. So I googled and dude, let me tell you: You just made my day! Regards,--

45.
Mike Tucker says at

Great job. One idea for a newer version-- an Event.COMPLETE that triggers whenever any single file is done loading, rather than having to add individual listeners...

46.
Oscar says at

Hi,

is it also possible to add new items to load on the fly? For example:

- you start the bulk Loader to load the items

- Can you now still put new items, even the loader already begin to load?

47.
Arthur Debert says at

:

Sure you can, with only one caveat: if you add items to a bulk loader instance before it's finished loading, your are golden. Else, if you add an item after the bulk loader is done loading all of it's assets, you must call

<bulkLoader>.start
again, because it was stopped when all items had finished loading.

48.
Yariv Gilad says at

At long last !!! thank you for sharing :)

49.
Daniel says at

Awesome, I was going to make something like this, but probably much less functional and reliable, so this saves a lot of time.

Looking forward to usingit

50.
Daniel says at

May I just mention one thing about the preloader ...

I've just started playing around with it, and think it might be of use pointing this out (unless it's already been done), but since it took me a while to figure out, I though I'd share it

the drawback of using an id like this is

loader.add("http://www.emptywhite.com/bulkloader-assets/shoes.jpg", {id:"bg"});

if you load the same file twice with two different id;s you won;t get the item back the second time but a null

this of course is rare, as why should you need to load the same item twice, but it's something i did as a test (and might for finished product still) and took me 15 min to figure out.

if you switch to NOT usind ids it's fine

I think that when you are loading the same item twice, it doesn't actually load it the second time, but retrieve t from cache right ? or ama I wrong on this?

anyhow - that's my $0.02

and it's a great and painless way to preload

51.
Daniel says at

I just saw that this was already discussed my appologies for repeating it...

52.
Marquez says at

Awesome class -- it worked like a charm on the first try. You rock! Thanks for sharing with the community.

53.
michael says at

great work, awesome class. we use it along with our framework and swfaddress and all works great!

q: is it possible to access/display the id of and item during the loadingProgress like:

private function onProgress(event:BalkProgressEvent):void { trace(event.id); }

best michael

54.
kyle says at

would bulk loader supports background loading in the future?

Scenario could be: - a bunch of MUST loaded assets that bulkloader loads and notifies for initial setup - a bunch of POTENTIAL assets that can be cached as background loading without user's notice a. if user happens to activate such asset, bulkloader notifies its already backgroundly loaded. b. or bulkloader initiates normal loading routine for asset that happen to be not yet loaded.

55.
Romuald says at

Hi,

Nice work, I'm using it on a project which has a lot of gallery.

Would it be possible to add a functionality?

instead of add an item and create a line for each item or use a loop:

loader = new BulkLoader(nameGallery); for (var i:uint = 0; i < myArrayOfFiles.length; i++) { loader.add(myArrayOfFiles[i]); } loader.start();

Could you parse the type or add another public method? To get:

loader.add(myArrayOfFiles); or loader.addItems(myArrayOfFiles);

Maybe it is already possible?

Romuald

56.
says at

Is it possible to access Symbols from a swf file which is loaded using BulkLoader ? Like using Loader class I do var abc:Class = event.target.applicationDomain.getDefinition("MySymbol") as Class; var mySquare:MovieClip = new abc() as MovieClip; addChild(mySquare);

57.
Arthur Debert says at

Folks, as stated above, this thread is way to long, and not a very good place for discussions. If possible, please direct your queries to the .

Thanks

:
Sure, just use a evt.target.id

:
It already does. It just requires some attention on you part to whether you'd like to manage two queues or actually one huge queue with the priorities being shuffled.

:
This seems way to spefic, and will only save you one line of code. ;-)

:
Sure is, just watch out for using the same ApplicationDomain (usuning the same Context instance), the mailing list has a few posts about this.

58.
Max Strebel says at

Tough I just downloaded it and am amazed - thanks for the great share, you saved my day.

59.
Lukas Vondruska says at

I tried out BulkLoader library and its really fantastic. Thank You very much for this great job.

60.
spina says at

Hi Arthur!

Cool Feature! I've only got one problem. I can't load a "local" picutre. Is it possible that only "online" stuff can be loaded?

if it's possible to load local stuff how do i have do reference it (path,...) ??

thx, spina

61.
Matt Pelham says at

Hey, found a great workaround to my previous post.

public function load_object(path, num, complete_function) { var object_id:String = "LoadObject_"+num.split("_")[0]+"_"+num.split("_")[1]; if (loader.get(object_id)!= null){ spawn_image_container(loader.get(object_id), object_id.toString().split("_")); }else{ loader.add(path, {priority:10,id:object_id}); loader.get(object_id).addEventListener(BulkLoader.COMPLETE, complete_function); } }


Hey All, I read through most of the comments but could not find anything regarding the BulkLoader.ERROR event. Specifically, I want to initiate some functions when Bulk-Loader completes loading an ID but should an ID already be loaded, nothing seems to pass. I noticed in (http://bulk-loader.googlecode.com/svn/trunk/src/br/com/stimuli/loading/BulkLoader.as) that it returns "item" but could not access the item in my own work. How do I pass a function when an ID has already been loaded? Thanks, Matt

62.
Matt Pelham says at

Hey All, I read through most of the comments but could not find anything regarding the BulkLoader.ERROR event. Specifically, I want to initiate some functions when Bulk-Loader completes loading an ID but should an ID already be loaded, nothing seems to pass. I noticed in (http://bulk-loader.googlecode.com/svn/trunk/src/br/com/stimuli/loading/BulkLoader.as) that it returns "item" but could not access the item in my own work. How do I pass a function when an ID has already been loaded? Thanks, Matt

63.
Martin says at

Hi i just found that the loader will fail on complete when i try to load an image that is generated by a script. Due to some limitations of the CMS i use i had to call a file called imghandler.HTML and the loader failed. I checked the headers with my proxy and they where fine. Now that i've managed to call the image through a script called imagehandler.JPG everything works fine although the output and headers are exactly the same.

64.
Arthur Debert says at

Hi Martin.

This blog entry is not a very good place for posting usage questions. If you still need some assistance, the mailing list (linked above in body) is the best place for that.

Cheers Arthur Debert

65.
Jon Low says at

Great class mate. Exactly what I was looking for!

66.
DN says at

Hey Arthur,

Newbie here, maybe I missed it but alot of my jpegs are in the swf which leads to a big 1meg file.. how can I load the SWF itself that is using Bulk Loader

67.
carl says at

Does this class support RTMP streaming?

68.
Khalid says at

Dude

You ROCK!!!!

I spent hours and hours literally pulling my hair in frustration over the bag of crap that is managing downloads in Flash. Your class is a beauty. Clean,Simple nd Efficient.

Thanks Man :)

69.
Valters says at

Thank you, very usable! :)

70.
Marko says at

Hello,

If I have, say, 5 items in BulkLoader and my last item fails to load, how do I know that it was the last item in the queue that failed to load? If one or more items fail to load, then COMPLETE event never gets fired and I don't know when BulkLoader has finished trying loading all items in the queue. Am I correct, or am I missing something here? Thanks.

71.
Csaby says at

Thank you!!!!!!!!! I've been searching for something like this a ling time!

Good job!

72.
Mike says at

Is it possible to load FLV's into a FLVPlayback Control. I can't seem to find documentation on this anywhere only using NetStream which I have been able to do.

73.
Angel Romero says at

Very Nice! This is some piece of work! Thanks for your contribution. I am going to make sure my users are aware of this library.

74.
Matt says at

Great Class! Thanks a lot!

Just a quick question! I am loading an external swf file with a sound embedded in the library. I can load the swf fine, but I don`t know how to access the sound.

Anyone know the code that will do this do this?

75.
Arthur Debert says at

Thanks for the kind words.

I do ask, however, to point usage questions to the , as it is a much better venue for this.

Cheers Arthur Debert

76.
rocker says at

This is moon! Thank you! I was thinking of writing a similar tool for my work (although with much smaller functionality), and this saves me many days. I love you :D

77.
Garrett says at

I truly appreciate your work! Thank You!

I am learning your package, and realized that in order for me to implement the BulkLoader.as, I would need to restructure my code. I don't fully understand the intricacies of the Object Tree, but I had an idea that you might be able to add a MovieClip or Sprite instance in the BulkLoader.add(url, mc), with the data loaded from the URL placed in the mc.

Just an idea.

thanks for your contributions.

78.
Michael Hoskins says at

Might want to run stripslashes() on your code there. I see all the quotation marks prefaced by backslashes.

79.
Arthur Debert says at

:

Thanks for the heads up!

80.
Sven says at

Yeah, and once again ... a huge class for doing it all. Apart from being able to change the alpha that is.

81.
Actimel says at

Is there any documentation or examples on preloading fonts ttf & other types?

82.
marcelo says at

foda

83.
aleksey says at

_bulkLoader.add("http://example.ru/manager/?xml", {id:"managerXml"});

_bulkLoader.start();

var mXML : XML = _bulkLoader.getXML("managerXml");

Error: [BulkLoader] Failed to get content with url: 'managerXml'as type: [class XML]

How load this xml?

84.
quick says at

I'm using the BulkLoader class to import multiple xmls . when I use the--

var thingy : XML = bulkLoader.getXML("file.xml");

I expected the thingy to then be an XMLObject, that could be used to access and navigate through as one would any XMLObject.

However, I'm unable to trace with any of the XMLObject methods.

example (children, child, etc...). This of course doesn't make any since.

any insight would be appreciated...Thanks

85.
Mike says at

Hi,

I'm trying to get progress event on multiple loading of FLVs.(30 of them!) I'm using the weight property but still only getting 1 progress event firing . What could I be doing wrong??

var loader:BulkLoader = new BulkLoader("3dMgtPreloader");

loader.add(MovieClip(parent).MyMigraine_Intro_mc.source, {weight:812, type:"video"}); loader.add(MovieClip(parent).MyMigraine_Main_mc.source, {weight:2209,type:"video", pausedAtStart:true}); //MyMigraine_Pan_mc.source, {type:"video", pausedAtStart:true}); loader.add(MovieClip(parent).MyMigraine_Replay_mc.source, {weight:338,type:"video", pausedAtStart:true}); loader.add(MovieClip(parent).MyMigraine_Help_mc.source, {weight:3175,type:"video", pausedAtStart:true}); loader.add(MovieClip(parent).MyMigraine_FlyUpA_mc.source, {weight:552,type:"video", pausedAtStart:true}); loader.add(MovieClip(parent).MyMigraine_FlyUpB_mc.source, {weight:600,type:"video", pausedAtStart:true});

loader.addEventListener(BulkLoader.PROGRESS, onAllProgress); //loader.addEventListener(BulkLoader.COMPLETE, onComplete);

loader.start()

function onAllProgress(e:ProgressEvent){

var perc1:Number = Math.floor(e.bytesLoaded * 100 / e.bytesTotal);

var perc:Number = loader.itemsLoaded / loader.itemsTotal;

}

86.
guru says at

Very Good! Thanks!

87.
jonobr1 says at

Do you know of a class like this for actionscript 2?

88.
Neil says at

I seem to be having a problem with BulkLoader if I addItem while it is loading. According to post #47 you can items while its still loading.

It seems that which ever item it was loading when i added new items, seems to be unrecoverable when i try to get that asset out later.

89.
Nitin Sharma says at

Hi Junio Vitorino, I am facing the same problem. Can you please tell me, how did you solve this.

1046: Type was not found or was not a compile-time constant: BulkProgressEvent.

everything was working fine before copying all the files from SVN

90.
Fernando says at

Hi, Arthur!

I just want to let you know that I added Bulk Loader to my site called AS3GameGears (http://www.as3gamegears.com/).

I am using it on one of our projects. It is a great tool, specially for game development where we need lots of assets. Congratulations and thanks!

91.
Saurabh says at

Brilliant brilliant class. Takes the preloader pain away. Thanks Arthur.

For anyone else struggling with the infamous null Object errors when loading swfs via Bulkloader, here's something basic you could check for.

Any stage references in the controller class of the swf being loaded might throw the whole thing off. In my stupid case, it was a stage.stageHeight access that broke the whole damn thing.

The best I could think of was pulled out the constructor code and pushed into another function (initClass). And then well..

public function controller():void { addEventListener(Event.ADDED_TO_STAGE. initClass); }

That fixed it, for now. So, just in case anyone else is stuck with something similar, there. That helped me.

92.
thomas sabo says at

Your article was good, ah, I love it. Hope to have more words for us to read! I wish you all the best! !

93.
Rajiv Srivastava says at

Nice Article. Hope for few more.

94.
Bryon says at

This seems like it could be used as a benchmark test for opening multiple connections to a server and testing/averaging download speeds. Is anyone using it for this purpose and do you think it could be geared toward visualization of tcp/ip socket latency?

95.
Tim says at

Hi,

This is great, however I'm struggling to "refresh" a swf loaded with bulkloader. I successfully load several game swf's and when the user is done with one they return to main menu. However when they return to that game it is in it's completed state, and I'm trying to reset it. Using removeChild doesn't do it, am I looking at this the wrong way? many thanks

96.
Martin Varesio says at

Then you can either use different id's or pass a URLRequest object directly and store it so it can be used to fetch...!

97.
Dan says at

It's used by Zynga Empire & Allies

98.
Woody Smith says at

Definitely, this class is very helpful to those looking for a very effective loading system. We are developing a new project and I definitely think that this would be a great tool specifically for game. Looking forward to work my way using your loader class. Thanks for this information.

Have the last word





posted by
Arthur Debert

on

Tagged with:

98 comments so far.
Say something

Other months availabe in 2007

The complete blog archive

The latest entries

Subscribe to comments on this entry: rss feed

Cloud me:

Feeds: Entries rss feed Linksrss feed Worksrss feed

A Django joint. hosted on Slicehost