dcsimg
A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: Preloader Problem

  1. #1
    Senior Member
    Join Date
    Feb 2001
    Posts
    124
    Does simulated streaming when you test out an .swf sometimes ignore the MC that is on the mainstage during the preload?

    My preloader is super simple, it works too, but the MC that is supposed to display while loading doesn't show-up until the simulated streaming hits about 90%.

    The MC is small and is located on frame 1. the preloading code is located on frame 2

    Would anything like an outside .txt or .as file affect that?
    What about the .swf's own file size?

    Here's the code:
    if (_root.getBytesTotal() == _root.getBytesLoaded()) {
    gotoAndPlay (3);
    } else {
    gotoAndPlay (1);
    }

    I'm supposed to have this ready tomorrow so I'm really freaked out.

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    You're probably using a component and/or Linkage (Export on first frame stuff...), and this will prevent your preloader (although it still does work!) from displaying properly.
    Only real way around this problem, is to create a new preloader movie, which sole purpose is to load your present movie (without it's own preloader!), in a holder clip or on another level.

    Keyone.it posted this easy example:

    http://pasodesign.com/extra/loader.fla

    It's fully commented and you just have to replace the "content.swf" with your file's name. Make sure you remove your present preloader from your movie.
    And this can really only be tested online.

  3. #3
    Senior Member
    Join Date
    Aug 2001
    Location
    Philippines
    Posts
    515
    hi oldnewbie!

    thanks, it worked a lot.

    i was able to load it, but the onLoad function doesn't seem to work as i understand it to. pls read the comments in the code for more info.

    Code:
    loadMovie("2 abtUs.swf", "abtUs");
    
    this.onEnterFrame = function() 
    {
    	loadedBytes = abtUs.getBytesLoaded();
    	totalBytes = abtUs.getBytesTotal();
    
    	if (loadedBytes == totalBytes)
    	{
    		preloader._visible = false;
    		//abtUs.gotoAndPlay(4);
                    /*i placed this w/o seeing onLoad function. apparently, it would call this EVERY frame. i found out soon after that that what the function onLoad is supposed to do */
    	} else
    	{
    		preloader._visible = true;
    	}
    	percent = Math.round( (loadedKBDisplay / totalKBDisplay) * 100);
    
    	percentDisplay = Math.round(percent) + "%";
    	loadedKBDisplay = Math.round(loadedBytes / 1024);
    	totalKBDisplay = Math.round(totalBytes / 1024);
    };
    
    abtUs.onLoad = function() 
    {
    	this.gotoAndPlay("main");
    	trace(this);
    	abtUs.gotoAndPlay("main");
    	gotoAndPlay("main");
    	this.gotoAndPlay(4);
    	gotoAndPlay(4);
    	abtUs.gotoAndPlay(4);
            /* i tried all of these.  i had to put this because i wanted the loadedMovie to only start when it's fully loaded. so in the 1st frame, there's a stop() action. then the frame after that is labeled "main" which plays the rest of the movie.  when i use this tho, nothing happens. i don't even see the preloader.*/
    };
    
    //stop();
    thanks man

  4. #4
    Senior Member
    Join Date
    Aug 2001
    Location
    Philippines
    Posts
    515
    help?

  5. #5
    Senior Member
    Join Date
    Aug 2001
    Location
    Philippines
    Posts
    515
    i really need ne1's help

  6. #6
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    That's not the simple code I referred you too in keyone.it's link!
    Have you tried that one or not?

  7. #7
    Senior Member
    Join Date
    Aug 2001
    Location
    Philippines
    Posts
    515
    it's the same, i just changed some vars i changed, ex., the loadMovie. i also used preloader for the preloader MC and abtUs for the loadMovie mc

  8. #8
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    This thing works fine without using the onLoad function().

    Just remove the stop you have on the first frame of your "to be loaded" movie, and don't add anything to the this.onEnterFrame = function().
    The movie will only start when it's fully loaded and not before that.

    Also the line if (loadedBytes == totalBytes), should actually be: if (loadedBytes === totalBytes) with 3 "=".

    That's only to turn off the display, otherwise you would still see it over your loaded movie.


  9. #9

    Only loads the first scene

    Hi,
    Any help you could give would be great.I came across this post and tried to use the preloader on my site.
    However..
    My main movie is made up of about 12 scenes and the preloader only loads the first one before the movie starts. The preloader continues to be visible in the background but the content plays over the top. Any solutions? THis was just what I've been searching for.

    Thanks and best regards

    Danny

  10. #10
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    ...about ???? 12 scenes
    Did you download the original .fla?

    http://pasodesign.com/extra/loader.fla

    Have you changed but the name of the file to be loaded?

    Are you loading other movies in your other scenes?

    Can you post a link to your .fla?

  11. #11
    Hi oldnewbie,

    I sent the link to your email.

    Thanks for your help.

    Danny

  12. #12
    Senior Member
    Join Date
    Aug 2001
    Location
    Philippines
    Posts
    515
    hi oldnewbie, thanks a lot!

    http://www.mydestiny.net/~rmmt/webpage2.zip

  13. #13
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Rmmt, that link ain't workin' for me!

  14. #14
    Senior Member
    Join Date
    Aug 2001
    Location
    Philippines
    Posts
    515

    sorry! :wow:

    try

    http://www.mydestiny.net/~rmmt/website2.zip
    i changed a few var names and the file name and all, but the struc is still the same

    i took out the other unnecessary files. only the button "about us" should work.

    thanks

  15. #15
    Senior Member
    Join Date
    Jul 2000
    Posts
    419
    I'm lost! whats the problem in this thread? hehe

  16. #16
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Rmmt, just e-mailed you! Check it out!

  17. #17
    Senior Member
    Join Date
    Aug 2001
    Location
    Philippines
    Posts
    515

    thanks a lot old newbie!

    thanks for ur help - there's a prob tho. i did what u said u did (remove the stop in the first frame of abtUs. it loads, but then abtUs just keeps looping and looping..? what code should stay in the onLoad function?

  18. #18
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Yeah! Ran in to some problems after e-mailing you when trying to deal with Danny's problem, in this same thread.
    Then realized that this preloader may have a few flaws!
    Quite busy again today! But will try to look into again at the end of the day! Will be back, or will e-mail you again!

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