A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: a problem with a preloader

  1. #1
    Junior Member
    Join Date
    Apr 2002
    Posts
    10

    Post

    i made a simple preloader for a site with flash mx. and i don't think i done anything wrong but...
    it loads ok, the percentage bar works fine but when it reaches 100% it doesn't go to the next scene where the site is located. i've checked if i mistyped the name of the scene, i checked if the scene where the preloader is is over the site scene...and nothing!!!
    can anyone tell me where my mistake is?

  2. #2
    Could you post your code please??

  3. #3
    Junior Member
    Join Date
    Apr 2002
    Posts
    10
    there are three frames in the preloader scene
    on the third frame there's an action. this is it:
    gotoAndPlay("da_site", 1);
    on the second the frame the action is:
    if (_root.getBytesLoaded() != _root.getbytestotal) {
    gotoAndPlay(1);
    }

    and of course there's an action in the preload bar instance but it's working so i doubt the error is there, but just in case:
    setProperty(this, _xscale, (_root.getBytesLoaded()/_root.getBytesTotal())*100);

    thanks in advance

  4. #4
    I think I miss something like this:
    Code:
    if (_root.getBytesLoaded() == _root.getbytestotal) { 
    gotoAndPlay("da_site"); 
    }


  5. #5
    Junior Member
    Join Date
    Apr 2002
    Posts
    10
    i think it's the same...but anyways i tried it and the result is the same...it just won't go to the next scene!!!

  6. #6
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,789
    instead of
    gotoAndPlay("da_site", 1);
    you can use
    nextScene();

  7. #7
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,789
    Originally posted by dennie
    I think I miss something like this:
    Code:
    if (_root.getBytesLoaded() == _root.getbytestotal) { 
    gotoAndPlay("da_site"); 
    }

    instead of another if (make it an else) you can put an else on the second frame

  8. #8
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Think you're continually looping this the wrong way.

    My usual "that kind of preloader" also holds 3 frames.

    --------------------------------------

    Frame 1:
    (Be carefull of CAPS!)

    if (_root.getBytesLoaded() >= _root.getBytesTotal() {
    gotoAndPlay("da_site"); // if "da_site" is the frame label of the targeted scene!
    // Otherwise it would be the scene name...
    gotoAndPlay("Scene 2", 1);
    }

    This frame should be blank & cleared of any displays, bars etc... And is only aimed at avoiding seeing a flash frame of the preloader if the file is already cached on the user's machine.

    Frame 2:
    (Really the same as frame 1!)
    (Be carefull of CAPS!)

    if (_root.getBytesLoaded() >= _root.getBytesTotal() {
    gotoAndPlay("da_site"); // if "da_site" is the frame label of the targeted scene!
    // Otherwise it would be the scene name...
    gotoAndPlay("Scene 2", 1);
    }

    Frame 3:
    (The loop...)

    gotoAndPlay(2);

    --------------------------------------

    On another layer(s), you can add textfields displays and bars or whatever visuals, but only on frames 2 & 3. Keep frame 1 clear of anything but the code!


    [Edited by oldnewbie on 04-17-2002 at 10:45 AM]

  9. #9
    Junior Member
    Join Date
    Mar 2002
    Posts
    21
    Originally posted by zbrox

    if (_root.getBytesLoaded() != _root.getbytestotal) {
    gotoAndPlay(1);
    }
    If that is truly your code verbatim, then you are missing the () for the _root.getBytesTotal in addition to the previously noted capitalization issue.

    so:

    Code:
    if ( _root.getBytesLoaded() != _root.getBytesTotal() ) 
    {
        gotoAndPlay(1);
    }
    Otherwise you're trying to compare the integer return value of _root.getBytesLoaded() with an [object][Function] value.

    skip

  10. #10
    Junior Member
    Join Date
    Apr 2002
    Posts
    10
    yes...i eventually found by accident that i've missed the brackets...such a stupid mistake!
    so sorry!

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