dcsimg
A Flash Developer Resource Site

Page 9 of 10 FirstFirst ... 5678910 LastLast
Results 161 to 180 of 189

Thread: For everyone with a preloader problem

  1. #161
    Senior Member
    Join Date
    Dec 2007
    Posts
    121
    I need your help people. your talking about preloaders. I have this code, and i want the preloader to fade once the movie has been loaded. here's the code

    Code:
    myInterval = setInterval(preload,100);
    
    function preload(){
    	var current = _root.getBytesLoaded();
    	var total = _root.getBytesTotal();
    	var pctLoaded = Math.round(current/total*100);
    	pct_txt.text = pctLoaded;
    	loaderBar_mc._xscale = pctLoaded;
    	
    	if(current >= total){
    		gotoAndStop("main",1);
    		clearInterval(myInterval);
    	}
    }
    can someone help?

  2. #162
    Senior Member
    Join Date
    Dec 2007
    Posts
    121
    I somehoe figured it out.. hope it's the only way to do it.. I put everything inside a movie clip again and here's is the actual code i'm using..

    Code:
    stop();
    
    myInterval = setInterval(preload,100);
    
    function preload(){
    	var current = _root.getBytesLoaded();
    	var total = _root.getBytesTotal();
    	var pctLoaded = Math.round(current/total*100);
    	fade_mc.pct_txt.text = pctLoaded;
    	fade_mc.loaderBar_mc._xscale = pctLoaded;
    	
    	if(current >= total){
    		if(fade_mc._alpha<=0){
    		gotoAndStop("main",1);
    		clearInterval(myInterval);
    		}
    		fade_mc._alpha -=5;
    	}
    }

  3. #163
    Junior Member
    Join Date
    Nov 2002
    Location
    Charlotte, NC
    Posts
    5
    Quote Originally Posted by whispers
    Im going to say that you have your preloader IN the .swf you are trying to preload? is this correct?
    Whispers,

    I was hoping that he was going to say "yes", because I am having trouble with a preloader not even appearing. My preloader is basically code on the first couple of frames of a large swf, so my preloader IS in the swf I'm trying to preload. What would your suggestion to spendirty have been if he had answered like me?

  4. #164
    Junior Member
    Join Date
    Dec 2008
    Posts
    5

    Preloader stuck on first frame

    Hi sportzguy

    i need some help with the preloader that i made. i followed one of the tutorials that i found on flashkit that displays messages (instead of a percent bar) for the viewers to read while the site is loading.

    heres the link to that tutorial: http://www.flashkit.com/tutorials/In...-855/index.php

    although when i uploaded it, it gets stuck on just the first message and doesn't even open to the actual site... so it just shows the preloader the whole time!

    you can check it out the site: www.askal.org

    I've attached a sample of what im working on so you could check out if i did something wrong

    i hope you could help me fix this

    thanks!!
    Attached Files Attached Files
    Last edited by streetdog; 12-02-2008 at 05:01 AM.

  5. #165
    Senior Member
    Join Date
    Dec 2007
    Posts
    121
    the movie clip called 'text' didn't have an instance name of 'text' . Thats why it won't work i presume..

    I attached your file .. and it works now
    Attached Files Attached Files

  6. #166
    Junior Member
    Join Date
    Dec 2008
    Posts
    5
    Quote Originally Posted by irkev
    the movie clip called 'text' didn't have an instance name of 'text' . Thats why it won't work i presume..

    I attached your file .. and it works now

    Hi Irkev, for some reason i couldnt open the file you sent. perhaps its because i have an old version of flash.
    in any case, i did what you suggested and now the messages are playing properly.. however, it doesnt go to the main movie, so its stuck playing the preloader.. what can i do to fix this?

  7. #167
    Senior Member
    Join Date
    Dec 2007
    Posts
    121
    i saved the flash file as a Flash 8 document..

    Well, can you post your code?

    As well as the Fla Please. So that i can see what's going one. Then i'll post the correct code for you

  8. #168
    Junior Member
    Join Date
    Dec 2008
    Posts
    5
    Quote Originally Posted by irkev
    i saved the flash file as a Flash 8 document..

    Well, can you post your code?

    As well as the Fla Please. So that i can see what's going one. Then i'll post the correct code for you

    Hi again,

    heres the code i got from the tutorial.this is in the first frame:
    Code:
    total = _root.getBytesTotal();
    	loaded = _root.getBytesLoaded();
    	if (loaded>=total) {
    		_root.gotoAndPlay(30)
    	}
    i am attaching my file again. this is with the correction you suggested - correcting the instance name for the movie clip text.

    when i try opening the fla you sent me, it says "Unexpected file format".. not sure what that means.
    Attached Files Attached Files
    Last edited by streetdog; 12-03-2008 at 03:52 AM.

  9. #169
    Senior Member
    Join Date
    Dec 2007
    Posts
    121
    you have this,

    _root.gotoAndPlay(30)

    but actually, on the preloader scene, you frame stops at 24!!

    also, rename scene 1, to main ! ! then try

    total = _root.getBytesTotal();
    loaded = _root.getBytesLoaded();
    if (loaded>=total) {
    gotoAndPlay("main",1)
    }

    let me know what happen

    don't put the _root.gotoAndPlay("main",1) , just gotoAndPlay("main",1)

    or try

    var amountLoaded = _root.getBytesLoaded()/_root.getBytesTotal()*100;
    if (amountLoaded>=100) {
    gotoAndPlay("main",1)
    }
    Last edited by irkev; 12-03-2008 at 02:09 PM.

  10. #170
    Junior Member
    Join Date
    Dec 2008
    Posts
    5
    Quote Originally Posted by irkev
    you have this,

    _root.gotoAndPlay(30)

    but actually, on the preloader scene, you frame stops at 24!!

    also, rename scene 1, to main ! ! then try

    total = _root.getBytesTotal();
    loaded = _root.getBytesLoaded();
    if (loaded>=total) {
    gotoAndPlay("main",1)
    }

    let me know what happen

    don't put the _root.gotoAndPlay("main",1) , just gotoAndPlay("main",1)

    or try

    var amountLoaded = _root.getBytesLoaded()/_root.getBytesTotal()*100;
    if (amountLoaded>=100) {
    gotoAndPlay("main",1)
    }
    Hi again irkev,

    I changed Scene 1 to main and tried both of the codes you suggested, however, the site still gets stuck at the preloader.
    i also extended the preloader to 100 frames, so that theres more time for each quote to be read.

    the actual swf file that i uploaded is 8,364KB. i dont suppose thats too big for it to take forever to load?
    could the problem be with the main movie? i have videos embedded in it.
    or is it just with the code of my preloader?

    thanks so much for helping so far really appreciate it!

  11. #171
    Member
    Join Date
    Jan 2009
    Posts
    45
    I have a question, is it possible to add kerning (letterspacing) in-between the numbers in a preloader? For example lets say I have a preloader that counts to 45 and i have two circles sitting side by side not overlapping. How would i go about adding a space in-between the numbers to have the number on the left in the left circle and the number on the right in the right circle?

    Here is the current code that I am using:
    Code:
    bytes_loaded = Math.round(_root.getBytesLoaded());
    bytes_total = Math.round(_root.getBytesTotal());
    getPercent = bytes_loaded/bytes_total;
    _root.loadText = Math.round(getPercent*28);
    if (bytes_loaded == bytes_total) {
    	_root.gotoAndPlay(3);
    }
    Thanks!

  12. #172
    Junior Member
    Join Date
    Jan 2009
    Posts
    1

    I have a question myself…

    Im using Flash CS3 AS 1.0 & 2.0. I want to make a preloader for my website. I have the initial preloader to the website worked out. But I want a preloader for when someone clicks on my images. What would be the AS? Does the preloader have to be on the keyframe before the image that is being preloaded or can it be on the same keyframe? The latter way to do it is preferred. All preloaders I've been checking out only deal with the first initial preloader and NOT for using it multiple times, etc. Can anyone help? Thanks!!!

  13. #173
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    in my footer may be something that will help you..or you may like..

    preloader1,2, or 3 link (cant remember which) is a component I made.. read the documentation..its VERY easy to use..

    in its easest use..you just drag it to the stage.. (give it an instance name)..

    and put in the parameter for what (empty) movieClip you want it to watch..

    anytime something gets loaded into it.... it will trigger the preloader to 'work'..

  14. #174
    Junior Member
    Join Date
    Jan 2009
    Posts
    22
    With the first original post, I took a look at the link to the tutorials I'm not sure if those do this or not...

    Do the tutorials preload everything in the library such as sound effects, movie clips, etc.? Whenever I have a sound effect in my game it stops to load it when it plays for the first time.

  15. #175
    Member
    Join Date
    Oct 2007
    Posts
    65
    Very nice thread. One question and it's been bothering me. Can we determine a percent amount to preload before playing a movie? So let's say i only want 30% of the movie to preload before playing it.

  16. #176
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    of course.. instead of waiting until bytesLoaded == bytesTotal

    you just check to see when bytesLoaded == 30;

  17. #177
    Senior Member
    Join Date
    Dec 2007
    Posts
    121
    well i was about to say what whispers said..

    But why would you want to preload your movie at 30%? The animation might be slugish, am I wrong?

  18. #178
    Member
    Join Date
    Oct 2007
    Posts
    65
    Hi Whispers and Irkev... thanks for the reply!

    30% was just a number I threw out there. I work with a client who has this "guideline" for there Flash ads, landing pages and/or anything with flv. The flash movies can only pre-load a certain amount before they have to begin. I would be able to increase or decrease the pre-load amount depending on the size of the Flash peice.

  19. #179

  20. #180
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    either way it should really matter...no?

    I mean 30% of any number is still 30%...

    example:
    Code:
    if (targetContainer.getBytesLoaded() > 0) {
    	var percent = Math.round((100 / targetContainer.getBytesTotal()) * targetContainer.getBytesLoaded());
    	if(percent == 30){
    		//start playing
    	}
    } else {
    	var percent = 0;
    }
    or really just:
    Code:
    var percent = Math.round((100 / targetContainer.getBytesTotal()) * targetContainer.getBytesLoaded());
    if(percent == 30){
    	//start playing
    }
    Im not sure how your using your 'check'...but the code is an example

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