A Flash Developer Resource Site

Page 1 of 3 123 LastLast
Results 1 to 20 of 42

Thread: [Resolved] [Resolved] [Resolved] YES... another problem with MX preloader

  1. #1
    The Metamorphic Mutant Mystique_MHz's Avatar
    Join Date
    Mar 2002
    Location
    Orlando, FL
    Posts
    218
    I have a main fla file called home.fla with two scenes [preloader and scene 1.]

    In the preloder scene I have two dynamic text fields one called "loadPercent" and the other called "loadBytes"

    key frame 1 of the preloder scene I have this code:
    loadpercent = "0%";
    loadBytes = "0 of "+Math.round((_root.getBytesTotal()/1024)*1000)/1000+" Kb";

    key frame 2 I have this code:
    loadPercent = (Math.floor(_root.getBytesLoaded()/_root.getBytesTotal()*100)+"%");
    loadBytes = (Math.round((_root.getBytesLoaded()/1024)*1000)/1000+" Kb of "+Math.round((_root.getBytesTotal()/1024)*1000)/1000+" Kb total Loaded.");
    if (_root.getBytesLoaded() == _root.getBytesTotal()) {
    // Check for finished loading
    // If loaded, final update to fields
    loadPercent = "100%";
    loadBytes = (Math.round((_root.getBytesLoaded()/1024)*1000)/1000+" Kb of "+Math.round((_root.getBytesTotal()/1024)*1000)/1000+" Kb total Loaded.");
    gotoAndPlay("Scene 1", 1);
    }

    key frame 3 I have this code:
    gotoAndPlay(2);

    Now, when I display this in a browser it shows 0% loaded and then playes scene 1. It doesn't show 100%. Why is that? Is there something diffrent with the code?

    Any help would be greatly appreciate it.


  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    if (_root.getBytesLoaded() == _root.getBytesTotal()) {...
    Try changing your above line to:

    if (_root.getBytesLoaded()>0 && _root.getBytesLoaded >= _root.getBytesTotal()) {...


  3. #3
    The Metamorphic Mutant Mystique_MHz's Avatar
    Join Date
    Mar 2002
    Location
    Orlando, FL
    Posts
    218
    Nope... that didn't work. But thanks anyhow

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    What if you add a stop(); action to replace (for this testing!) your gotoAndPlay("Scene 1", 1); line?
    Think this is so fast when tested locally, that you're simply not seeing the 100% mark!
    Test it online, to see if you see lower percentages than 100% on the initial download.

    Understand what I'm getting at?

  5. #5
    That same code worked when I streamed a 95kb file.

  6. #6
    The Metamorphic Mutant Mystique_MHz's Avatar
    Join Date
    Mar 2002
    Location
    Orlando, FL
    Posts
    218
    I placed a stop action and then I viewed it streaming from the flash player and I noticed that it counted up to 100% but then it jumped from 100% back to 0%. Why is that?

  7. #7
    Can you post a link to your swf file so we can see how it streams?

  8. #8
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Works fine for me! Stays at 100%!

  9. #9
    The Metamorphic Mutant Mystique_MHz's Avatar
    Join Date
    Mar 2002
    Location
    Orlando, FL
    Posts
    218
    Originally posted by McFalski
    Can you post a link to your swf file so we can see how it streams?
    not at the moment... I'll see what I can do.

  10. #10
    The Metamorphic Mutant Mystique_MHz's Avatar
    Join Date
    Mar 2002
    Location
    Orlando, FL
    Posts
    218
    I put it here http://www.eforce.net/dcmedia_v4.html temporairly so you can see it streaming... it still shows up as 0% then it playes all of the swf files. This is realy starting to **** me off


  11. #11
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    No! Just checked it on my 56k dial-up (big files you have there!), and your preloader doesn't seem to be working properly, probably because you used components and/or export on first frame stuff (what about those sound files?).
    I only see the initial preloader, and it doesnt show up until +/- 60% of bytes have downloaded. You'll have to create a new preloader movie as we've been discussing in this thread:
    http://board.flashkit.com/board/show...hreadid=356040

    On top of that, are you starting other loads in the background when your main movie starts playing?

    Hotmail won't accept what I suspect as being quite large files, so if you want me to have a look, at your main movie's preloader at least, post a link to your uploaded .flas, or e-mail me a link to them.
    You can do that by hitting the e-mail box at the bottom of this post.

  12. #12
    The Metamorphic Mutant Mystique_MHz's Avatar
    Join Date
    Mar 2002
    Location
    Orlando, FL
    Posts
    218
    Yes... they are preety big file because I use video and a lot of jpegs.

    I'll try and see if I can save the files somewhere on my server. I'll e-mail you with the info.

    Thanks

  13. #13

    It worked for me

    it still shows up as 0%
    For me, the percentage started at around 90% and then 91,92... until 99. I don't see the 0% that you were talking about. BTW, oldnewbie's right about the components stuff, however that shouldn't be the reason why you are seeing 0%. Maybe you have a corrupted Flash Player. Try downloading a new one from Macromedia and see if the problem persists. (Make sure you do it the right way)

  14. #14
    The Metamorphic Mutant Mystique_MHz's Avatar
    Join Date
    Mar 2002
    Location
    Orlando, FL
    Posts
    218
    Oldnewbie... did you get the e-mail I send you with a link to the fla's?

    Thanks

  15. #15
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Just got it and replied!

  16. #16
    The Metamorphic Mutant Mystique_MHz's Avatar
    Join Date
    Mar 2002
    Location
    Orlando, FL
    Posts
    218
    So... during my lunch break I went to Barnes & Nobles and spent $30 on this book:
    http://search.barnesandnoble.com/boo...sbn=0201758466

    Basicly it tells me to place a moviclip on the main timeline with a rectangle box *bar* to indicate the progressBar and a dynamic text field *myTextField* where my percent number will be displayed.

    Sounds simple right?!.... Then, I have this code on keyfrome one:
    stop();
    myInterval = setInterval(preloader, 10);
    function preloader() {
    if (getBytesLoaded()>=getBytesTotal()) {
    play();
    clearInterval(myInterval);
    }
    bar._xscale = (getBytesLoaded()/getBytesTotal())*100;
    myTextField.text = Math.round(getBytesLoaded()/getBytesTotal()*100)+"%";
    }

    Basicly the movie starts on the second keyframe.

    Now, I have a diffrent problem... the dynamic text box called "myTextField" doesn't show the number of percent loading until it reaches 98% and then it starts to count off 98, 99, and finally 100.

    Why the delay?

    I swear I'm going back to flash 5 because of this!!!!!! AAARRRRRRrrrrrrr

  17. #17
    When you use Macromedia's components, it's 'exported on the first frame'. That means all the data of the components you are using in the movie are stored on the first frame of the movie. (even though you won't use the text scroller until the last frame of your movie) This causes many problems because your preloader is on your first frame too, and as a result your preloader will not show up (a blank screen does) when people are downloading the components. (the components usually takes up quite a bit of space).
    Say if you have a text ScrollBar component on the 20th frame of you movie, and a preloader on the first 2 frames, people would have to download the ScrollBar component(21KB) before they download the preloader(1KB). That is why you are seeing nothing for quite a time before the preloader kicks in. (By which time, the movie's probably half loaded)

    The solution, as oldnewbie pointed out, is to have an external preloader. Follow his link and read that thread. However you may want to make a few changes to his script to make it work correctly. (BTW, oldnewbie, your preloader has a bug.)
    [Edited by McFalski on 08-20-2002 at 04:35 PM]

  18. #18
    The Metamorphic Mutant Mystique_MHz's Avatar
    Join Date
    Mar 2002
    Location
    Orlando, FL
    Posts
    218
    Yes... but I need it to load other swf files into the main timeline

    Although... it's very clever... His solution can only be used once.

  19. #19
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    ...(BTW, oldnewbie, your preloader has a bug.)
    Care to share?
    Never pretender it was perfect! And it was never intended, as coded, to be a generic preloader in the first place!

  20. #20
    From your preloader, the movie would start playing before it's finished loading. If there is a 21KB component on the first frame and the rest of the movie is 400KB, then your preloader would start playing after it loads the 21KB and frame 2, but frame 3+ are still not loaded yet:

    if (LoadedBytes != TotalBytes) {
    //put something here that prevents the movie from playing before it's loaded.
    //I don't know if container.stop() can do it, but most likey, it would still show the first frame.
    }

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