ok..
my main timeline is only 1 frame long as everything is contained in movie clips.
i created a listener with this code on frame 1.
Code:
var myLoadListener:Object = new Object();
myLoadListener.onLoadStart = function(target_mc:MovieClip) {
trace("Your load has begun on movie clip = "+target_mc);
var loadProgress:Object = myLoadListener.getProgress(target_mc);
trace(loadProgress.bytesLoaded+" = bytes loaded at start");
_root.varTotal = _root.varTotal + Number(loadProgress.bytesTotal);
_root.b_t.text = _root.varTotal;
trace(loadProgress.bytesTotal+" = bytes total at start");
};
myLoadListener.onLoadProgress = function(target_mc:MovieClip, loadedBytes:Number, totalBytes:Number) {
trace("onLoadProgress() called back on movie clip "+target_mc);
trace(loadedBytes+" = bytes loaded at progress callback");
trace(totalBytes+" = bytes total at progress callback");
};
// variable to hold total number of bytes to load.
var varTotal:Number = 0;
pretty much straight from the doco...
now for the complicated part. i'll attempt some ascii art
Code:
_root┐
└pic_container┐
└whole┐
├left
└right
ok lets break it down.
whole is a mc in my library which has two panels (left and right) mc's on it. they have the dimensions that i want. (i know i can use create clip functions, i just like being visual sometimes)
ok this is the code in the first frame of pic_container. it creates 5 instances of whole (will be 50 when i get this to work properly)
Code:
function initial_pics()
{
whole_count = 0;
for (i=1;i<=10;i++)
{
whole_count++;
new_whole = attachMovie("pic_whole","whole"+whole_count,i);
// trace(new_whole);
new_whole._alpha = 0;
var my_str:String = String(i);
while (my_str.length < 3) {
my_str = "0" + my_str;
}
// trace(my_str);
var leftLoader:MovieClipLoader = new MovieClipLoader();
leftLoader.addListener(_root.myLoadListener);
leftLoader.loadClip("images_folio/hamish"+my_str+".jpg",new_whole.left);
i++;
var my_str:String = String(i);
while (my_str.length < 3) {
my_str = "0" + my_str;
}
// trace(my_str);
var loadRight:MovieClipLoader = new MovieClipLoader();
loadRight.addListener(_root.myLoadListener);
loadRight.loadClip("images_folio/hamish"+my_str+".jpg",new_whole.right);
} // end of for loop
} // end of intial pics function
initial_pics();
now this works when i was just using loadMovie into the left and right mc's, but i want to make the thumbnail buttons that are placed elsewhere to be disabled until i have everything loaded.
now the onLoadStart function does get called.
the first trace returns this x 10 (with the pic name incremented)
"Your load has begun on movie clip = _level0.pic_con.whole1.left"
but the values of bytesLoaded and bytesTotal are undefined. I know that the load progress doesn't work in the test movie environment, so i tried it on a local webserver and also uploading it to a actual webhost. i still get the same result. The text field shows "NaN", i know that's because it tries to convert 'undefined' to a number.
ok this is a massive post and i tried to be as clear as possible.. hopefully there is a simple solution.
(like last night when i was debugging a php script for 5 hours just to find a ; between the closing bracket of if statement condition and the opening curly bracket and it's removal instantly rectified everything ).