A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [MX] This one has really got me! - Reflecting load totals for multiple clips.

  1. #1
    Senior Member pup100's Avatar
    Join Date
    Oct 2004
    Location
    Close
    Posts
    575

    [MX] This one has really got me! - Reflecting load totals for multiple clips.

    Hi,

    What on the surface appeared to be an easy task has turned into a REAL mind bender!

    I've got 3 clips being loaded into holding clips within a main clip.

    What I want to do is give loading progress for the 3 clips as they are loaded in, so...... I have set up a loop to give me the “bytesLoaded” amount for each clip within an onEnterframe event

    code:
    _root.holdtext_mc.onEnterFrame = function() {
    for (i in _root.ticking_array) {//ticking_array holds references to the clips.
    eachLoad = (Math.floor((_root.ticking_array[i].getBytesLoaded()/1024)));



    Now I've got no problem with the amounts being captured by “eachLoad” - 3 progressing totals correctly giving the amounts of each clip loading – Where it is all going tits up is how I can get a total for these 3 amounts reflected in a trace statement or text field.

    It sounds simple but has got the better of me! I have tried to load them into an array, but my understanding is that you cannot easily update the parameter held in an array without removing it first so the code

    code:
    _root.holdtext_mc.onEnterFrame = function() {
    for (i in _root.ticking_array) {
    _root.tot_array.push(Math.floor((_root.ticking_arr ay[i].getBytesLoaded()/1024)));


    }


    will just stuff a new amount into a new position in the array

    I have tried to use a variable to capture each amount & then add that to a variable keeping track of the total but at best this will give you an “Unnatural” block amount as the totals for all 3 clips are traced out – say first frame 34 next frame & trace statement 64 no single unit incrementation.

    Any help please.
    You will know everything when you know you never will.

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    What's wrong with
    code:

    _root.holdtext_mc.onEnterFrame = function()
    {
    var total = 0;
    for (i in _root.ticking_array)
    {
    eachLoad = (Math.floor((_root.ticking_array[i].getBytesLoaded() / 1024)));
    total += eachLoad;
    }
    trace (total);
    };


    ?

  3. #3
    Senior Member pup100's Avatar
    Join Date
    Oct 2004
    Location
    Close
    Posts
    575
    nunomira - I have just got my wife to hit me over the head with a frying pan!!!

    Your code works like a dream!

    In trying it the other day I had left an old irrelevant trace variable & so nothing was happening & took it that your kind example was not quite what i needed.

    Of course you where right - some times one gets so wrapped up in a problem that you don't see the wood for the trees! or more apt the simple from the complicated.

    I thank you once again sir!
    You will know everything when you know you never will.

  4. #4
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    Those things don't happen only for those that don't code.


    I'm glad it's solved.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center