dcsimg
A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: preloading Problem

  1. #1
    Junior Member
    Join Date
    Aug 2003
    Location
    Dorset, UK
    Posts
    12

    preloading Problem

    hi all,
    I have a problem with preloaders
    My movie loads external SWF's. each swf has a preloader scene with this code
    Code:
    bytes_loaded = Math.round(getBytesLoaded());
    bytes_total = Math.round(getBytesTotal());
    getPercent = bytes_loaded/bytes_total;
    this.loadBar._width = getPercent*200;
    this.loadText = Math.round(getPercent*100)+"%";
    if (bytes_loaded == bytes_total) {
    	gotoAndPlay("Scene 1",1);
    }
    On my modem connection at home it works fine but at work the preloader doesnt appear. I get a blank screen untill the whole movie has loaded then it goes straight to Scene 1 frame 1.

    Could our proxy server be causing problems?
    Can anyone offer any help?

    TIA

    Ian

  2. #2
    Senior Member
    Join Date
    Nov 2000
    Posts
    302
    Hi,

    Is the system/connection at work slower/faster than at home?
    Is the size of the preloader small enough?

    Sometime building in a pre-preloader helps if the preloader is a bit 'voluptuous'. Put it on the second frame, and start your main preloader at 3 (lable it "MainPreloader" or something). Leave the first frames empty.

    if (_root.getBytesLoaded()==_root.getBytesTotal()) {
    gotoAndPlay("Scene1", 1);
    }
    // N is the number of frames in your preloader.
    if (_root._framesloaded > N) {
    gotoAndPlay("MainPreloader");
    }

    cYa
    [swf width="300" height="40" background="#FFDDBB"]http://www.cid-iv.com/flash/Banner/footer.swf[/swf]

  3. #3
    Junior Member
    Join Date
    Aug 2003
    Location
    Dorset, UK
    Posts
    12
    thanks for the reply

    work has an ISDN connection and home is a 56k modem.
    i know my preloader works fine on all the systems i have tried it on apart from at work.

    the size of the preloader should be tiny, its only a couple of words, a dynamic text box and a bar that changes length

    you can check it out here -> www.orchardcdg.co.uk/home.htm

    i seems that our server at work is holding onto the incoming files and then sending them to my terminal when it is downloaded instead of streaming it (?)

    i have also had problems with other peoples preloaders not working so i was wondering if it is a known problem with proxy servers?

  4. #4
    Senior Member
    Join Date
    Nov 2000
    Posts
    302
    Well, honestly, I don't know. Could be. I'm no server wiz.
    [swf width="300" height="40" background="#FFDDBB"]http://www.cid-iv.com/flash/Banner/footer.swf[/swf]

  5. #5
    Junior Member
    Join Date
    Aug 2003
    Location
    Dorset, UK
    Posts
    12
    thanks for trying!

    anyone else?

  6. #6
    Senior Member
    Join Date
    Nov 2000
    Posts
    302
    No probs! Happy Flashing!
    [swf width="300" height="40" background="#FFDDBB"]http://www.cid-iv.com/flash/Banner/footer.swf[/swf]

  7. #7
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Change this line

    this.loadBar._width = getPercent*200;
    to

    this.loadBar._xscale = getPercent*100;

    also give your frames names like "scene1Frame1"
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  8. #8
    Junior Member
    Join Date
    Aug 2003
    Location
    Dorset, UK
    Posts
    12
    ok, i'll try it thanks.
    the reason for
    Code:
    this.loadBar._width = getPercent*200;
    is because the finisehed length of the movie clip is 200px.

    I know the preloader works but its just not being displayed

  9. #9
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    A link?

    You could have a generic preloader in your main movie, that preloads all of your other movies, without them having their own preloaders...

    http://www.flashkit.com/board/showth...hreadid=456020

    As for your preloading code, there first should be some reference to what you're loading, eiter _root, or more probably in your case, at least this...

    bytes_loaded = Math.round(this.getBytesLoaded());
    bytes_total = Math.round(this.getBytesTotal());
    getPercent = bytes_loaded/bytes_total;

    If your loadBar graphic is actually 200 pixels long, use _xscale instead of _width... And 100%...
    this.loadBar._xscale = getPercent*100;

    this.loadText = Math.round(getPercent*100)+"%";

    You should use >= in your if statement, rather than ==...

    if (bytes_loaded >= bytes_total) {
    gotoAndPlay("Scene 1",1);
    }

    Now if you're using components, Export on the first frame stuff (attached movie clips or sound objects) and/or embedding fonts in your movies, then the preloader might not display correctly anyways, until all that has to be downloaded on the first frame has...

    You would then need a workaround...

  10. #10
    Junior Member
    Join Date
    Aug 2003
    Location
    Dorset, UK
    Posts
    12
    thanks for the reply. i'll take a look at your zip file

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