A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Preloader issue - code is correct, but preloader is flakey

  1. #1
    Junior Member
    Join Date
    Nov 2005
    Posts
    2

    Preloader issue - code is correct, but preloader is flakey

    I'm using Flash MX 2004 to develop a flash-based website.

    There is one main movie, and several external .swf's that are loaded into the main movie as needed.

    All movies have a basic preloader, created as follows:

    All movies have 2 scenes.
    The first scene contains the preloader, which is 3 frames in total.

    Frame 1 contains the following script:
    bytes_loaded = Math.round(this.getBytesLoaded());
    bytes_total = Math.round(this.getBytesTotal());
    getPercent = bytes_loaded/bytes_total;
    this.loadText = Math.round(getPercent*100)+"%";
    if (bytes_loaded == bytes_total) {
    this.gotoAndPlay(3);
    }

    Frame 2 contains the following:
    this.gotoAndPlay(1);

    Frame 3 is blank.

    There is a 2nd layer which contains a dynamic text box which calls the variable "loadText".

    This preloader works great in the main movie. The main movie contains buttons which call external SWFs to be loaded into a holder MC on the main movie's timeline. When I load an external SWF into my main movie, the preloader doesn't show up at first. At about 60%, the preloader FINALLY shows up and counts the last 40% before the movie plays.

    After several attempts, I noticed that the problem is not with the code itself, but might have something to do with the amount of data loaded into frame 1 of my movies.

    Using the debugging tool, and looking at the graph that Flash provides when previewing a movie, I noticed that my main movie contains about 5kb of data in Frame 1, and as mentioned above, the preloader works just fine.

    When previewing each of my external SWFs separately, I noticed that the amount of data on Frame 1 of those movies is much greater - 101kb.

    After searching the help files, I read somewhere that Flash MX 2004 loads certain data into the first frame of the movie by default, and I'm guessing that THAT is what's causing the preloader not to show up instantly.

    Would appreciate any help in clarifying this issue, as the site is completely done except for this preloader problem.

    TIA.

  2. #2
    Genius on Demand
    Join Date
    Oct 2005
    Location
    Brandon, Fl
    Posts
    24
    if you are using any components, embedded fonts, dynamically loaded library items just to name a few, they all load before anything else does in your movie. as far as components, unfortunately you can't do anything about it. exported library items have a property that allows you to not export them in the first frame of your movie. right click on the library item and go to linkage to find it. check the size of your preloader. i have actually seen some preloaders that needed preloaders because they are so big.

  3. #3
    Junior Member
    Join Date
    Nov 2005
    Posts
    2
    Quote Originally Posted by surfpunk
    if you are using any components, embedded fonts, dynamically loaded library items just to name a few, they all load before anything else does in your movie. as far as components, unfortunately you can't do anything about it. exported library items have a property that allows you to not export them in the first frame of your movie. right click on the library item and go to linkage to find it. check the size of your preloader. i have actually seen some preloaders that needed preloaders because they are so big.
    Ahhh! that clears up a lot. I am positive the preloader is small. But I am using linkage properties and the attachMovie function to load movies in the library.

    Thanks for your help.

  4. #4
    Genius on Demand
    Join Date
    Oct 2005
    Location
    Brandon, Fl
    Posts
    24
    no problem, happy to help

  5. #5
    Member
    Join Date
    Oct 2005
    Posts
    51
    huh... a preloader for a preloader. Interesting.

    I'm trying to lose the master container and detect the size of an external swf (the site is just the swf... it gets resized depending on the size of the browser window - the url will be www.whatever.com/main.swf) with a preloader? So, there will be an html page that gives the viewer the choice of highspeed site (main.swf) or the low speed version (html). Do either of you guys know how this might work?

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