Preloader Woes
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Preloader Woes

  1. #1
    Senior Member
    Join Date
    Jul 2001
    Posts
    2,467
    Hi:

    A have an intro that I get to preload properly.

    Here is the script I am currently using:

    Code:
    onClipEvent (load) {
    _visible=true;
    }
    onClipEvent(enterFrame) {
     percentloaded=Math.round(_level1.getBytesLoaded()/_level1.getBytesTotal()*100);
     percentDisplay=percentloaded + "%";
     if(percentloaded==100 && !initialized) {
      initialized=true;
      _visible=false;
      _level1.gotoAndStop (1);
      
    }
    }
    I tried using the above script as a single frame in a "preloader" scene (above Scene 1) in the main (intro) movie, but the percentage always shows up at around 60% loaded, then immediately disappears, and the movie starts to play.

    Now, as you can see (i.e.,_level1), I created an empty movie, containing nothing but my preloader script & the (percentDisplay) text field, then loaded my intro into it.
    The preloader starts from 0% in this case, but the movie still starts at around 60-70%, while the preloader is still counting down on screen.


    I use this same preloader to load music sound tracks on my portfolio site, and it works fine.

    Also, I tried using another preloader with this intro, the one which I use to preload my portfolio, but it doesn't work either, altough it works great on my site, under the same circumstances, i.e., as a preloader scene.

    Can anyone offer an suggestions as to why these don't work with this intro? I don't want the intro to start playing while the preloader is still on screen counting down, and I'm not catching on as to why I have to load this intro into level one, and preload it from another movie. Any advice?

    The intro can be found here:

    http://www.ekigroup.com



    Thanks,



    James
    He is risen!!!




  2. #2
    Moderator
    Join Date
    Feb 2001
    Posts
    13,044
    Hi James,

    look for preloader at http://www.fontimages.org.uk ...
    and check this thread http://board.flashkit.com/board/show...hreadid=289032

    Musicman

  3. #3
    Senior Member
    Join Date
    Jul 2001
    Posts
    2,467
    Hi Musicman:


    Thanks for taking your time to give me a hand.

    Unfortunately, your swf merge script didn't work in my case. In fact, when I added the xtra frame to the preloader, the swf got caught in an ifinite loop, which caused it to keep restarting. Without the extra frame, it played all the way through, and the preloader did show up, but it never budged off of 0%, and remained on screen while the entire intro played.

    Anyway, as I said previously, my preloader now starts at 0% anyway. The problem is no longer it counting down from 60%, but starting to play at 60%. It counts down from 0% - 60%, then goes to frame one and starts to play. Luckily, the bulk of the movie is in frames 1-200 (2454 total), so this isn't a big problem, and I guess I can live with it.

    The way it is now, I have a 2454 frame intro containing exported sounds, and a one frame preloader movie, containing nothing but one MC. The intro is loaded into level1 of the preloader movie from the main timeline, and the dynamic text field, which displays the percent loaded, is in an MC in frame one of the main timeline, with the code from my first post attached to it.



    Thanks, again, for your help.


    James
    He is risen!!!




  4. #4
    Senior Member
    Join Date
    Jul 2001
    Posts
    2,467
    BTW, I have a mild interest in your Flash e-Card PHP script, but I couldn't get it to work either. I uploaded the PHP file to my server, with the .php extension, then copied the HTML form you use on your site, and uploaded it to the same directory. Below is the errors I got:




    Code:
    <br>
    <b>Warning</b>:  Unable to create 'tmp/tmp_1027783169':  No such file or directory in <b>swfaddvars.php</b> on line <b>152</b><br>
    <br>
    <b>Warning</b>:  Unable to move '/var/tmp//phpByjowa' to 'tmp/tmp_1027783169' in <b>swfaddvars.php</b> on line <b>152</b><br>
    <br>
    <b>Warning</b>:  fopen("tmp/tmp_1027783169","r") - No such file or directory in <b>swfaddvars.php</b> on line <b>13</b><br>
    <br>
    <b>Warning</b>:  Supplied argument is not a valid File-Handle resource in <b>swfaddvars.php</b> on line <b>63</b><br>
    <br>
    <b>Warning</b>:  Cannot add header information - headers already sent by (output started at swfaddvars.php:152) in <b>swfaddvars.php</b> on line <b>172</b><br>
    <br>
    <b>Warning</b>:  Cannot add header information - headers already sent by (output started at swfaddvars.php:152) in <b>swfaddvars.php</b> on line <b>173</b><br>
    FWS        <br>
    <b>Warning</b>:  Supplied argument is not a valid File-Handle resource in <b>swfaddvars.php</b> on line <b>88</b><br>
    <br>
    <b>Fatal error</b>:  pack type v: not enough input, need 2, have 0 in <b>swfaddvars.php</b> on line <b>90</b><br>

    The script is supposed to create the tmp file, right?

    James
    He is risen!!!

  5. #5
    Moderator
    Join Date
    Feb 2001
    Posts
    13,044
    Hi James,

    about the preloader ... remember those comments about frame numbers, labels, etc. Say you have a main movie with a jump from frme 4 to frme 2 somewhere, and you add 2 frames of preloader. The resulting movie will jump to frame 2 (total) which is not where it should go.

    adding vars: the way it is set up, the script wants a writable (chmod 777) tmp directory to operate. You should probably change it so that the $ifile refers to a specific swf on your server.
    Also, there may be a minor bug in the version you downloaded. Make sure addtag function reads like this...
    Code:
    function addtag($tag, $data)
    {       $val = $tag << 6;
            if(($l = strlen($data)) >= 63)
                    return pack("vV", $val+63, $l) . $data;
            else
                    return pack("v", $val+$l) . $data;
    }
    This script is made for (and running on) a server with php 4.0 - if your server is >= 4.1, be sure to refer to $_POST etc.

    Musicman

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

Poll by Flashkit.com