For my portfolio flash site i am using LoaderMax from greensock. Why did i use LoaderMax ? Well first i just started using LoaderMax and i am new to it. I am using LoaderMax for two very basic reason:
1) Loading multiple images easily. Well i want to calculate whole progress of multiple assets loading and show it in loading progress which was difficult for me to do when doing it in traditional sequential manner (using loader class). It was tough to find bytes total of all images as i used to load images one by one in sequence.
2) Garbage collection/resource release: When i used to load images using typical loader class, i used to face a problem though i later solved it but still i don’t have to go extra step in case of LoaderMax. The problem was when loading was in progress and i closed my browser window then an error was thrown saying “loading never complete” as shown in my previous post. But with LoaderMax i don’t have to worry about it because it releases the memory if loading process gets paused or aborted.

But in this post i am not discussing the tutorial to use LoaderMax or its features. As always i faced a certain problem and i solved it xD. So i wrote a code module including LoaderMax which ran flawlessly on all web browsers (internet explorer, chrome, opera, and safari) but it didn’t run on Mozilla Firefox. When running on Firefox an exception error was getting thrown and i spent 1 hour to find the reason and couldn’t find it and got me pissed me off xD. First let me show you the code module that i wrote and was throwing exception on firefox:

var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});

queue.append( new ImageLoader("img/photo1.jpg", {name:"photo1"}) );
//start loading
queue.load();
function completeHandler(event:LoaderEvent):void {
    var image:ContentDisplay = LoaderMax.getContent("photo1");
}

here is the screenshot of error:

In first statement of function completeHandler i am retrieving loaded image. I am sending it to my resize algorithm later to resize the original image to fit into my target area. But it throws error on firefox because it says invalid bitmapdata. My resize algorithm takes displayobject as parameter and ContentDisplay extends Sprite class. Note: LoaderMax can also resize your original image according to aspect ratio

I didn't understand why this error was coming in firefox but not in other browsers. At first i thought maybe my algorithm was having issues with type ContentDisplay so i re-wrote my completeHandler function as follows:

function completeHandler(event:LoaderEvent):void {
    var image:Bitmap = LoaderMax.getLoader("photo1").rawContent;
}

The above new statement gives me bitmap. Now i run my module and guess what ? yay yepee it didn't run on firefox but ran on other browsers xD and this time i got null exception, yeah above statement returned null, weird rite ?? I was frustrated and cussing firefox xD. But accidently while doing just trial and error i added few parameters and viola boom bang dang it got running on firefox and all browsers xD. here is the new change that i made :

queue.append( new ImageLoader("img/photo1.jpg", {name:"photo1", estimatedBytes:2400}) );

well if u have noticed, i have added new parameter called "estimatedBytes". Yes, just this parameter solved above problem and again i was left scratching my head heheheh xD.

Gracias.