-
Preloader doesn't appear until 50% done...
Anyone know why this is? I have a scrollpane in my movie and someone told me a while back that it might account for this problem. Well, I took it out and nothing changed. Can anyone help me out? thanks!
------
code for preloader:
frame1-
totalBytes = this.getBytesTotal();
loadedBytes = this.getBytesLoaded();
remainingBytes = totalBytes - loadedBytes
percentDone = int((loadedBytes/totalBytes)*100);
bar.gotoAndStop(percentDone);
if (_framesloaded == _totalframes) {
gotoAndPlay(3);
}
frame2-
gotoAndPlay(1);
-------
everything is setup properly from what I can tell, but maybe this is a problem others have run into and there is a specific reason? thanks!
-
Senior Member
Either the graphics in the preloader take 50% of the total kb or you use components or attached movies within your movie. They always load first, even before the preloader.
Did you also delete the scrollpane from the library ?
-
I do have some loadmovie commands in the main timeline. And no, I didn't delete the components from the library. How would I setup the loadmovies so that they are loaded when they are actually called in the timeline and not when the timeline itself loads? thanks a bunch!
-
You have to delete the component from the library, otherwise, it still takes size in the first frame. Really frustrating.
For the loadMovie(), simply put on the timeline and it will run when flash plays on the timeline.
-
Originally posted by zhenjyu
For the loadMovie(), simply put on the timeline and it will run when flash plays on the timeline.
Alright, that's what I have right now. So it doesn't load that movie before playing it right? Let me try taking the component out of the library and seeing if that helps. Thanks
-
sounds like your preloader is too large.. make it light like arround 10k or less
volkswagens kill people!
-
oh, it's tiny, just a basic bar preloader. it's not the preloader... I put the same preloader in a test movie and it worked fine, but for some reason, it won't display here. I've taken out all of my loadmovie actions and components, but to no avail. It STILL lags. I guess it's hard to determine what's going on through the info I've given but what I'm really hoping for is someone that's had a similar problem and may know how to fix it. I'm loading in a lot of pic sequences and image files. Could that be it?
-
AH HA! Ok, making progress. I had a jpeg sequence with 75 frames that after I deleted from my library, the preloader now displays starting at 30%. I guess I'm confused as to why having so many images would interfere with the preloader being displayed. Anyone have any ideas? (I don't want to delete every outside image just to get my preloader to work.. that doesn't seem to make much sense) thanks
-
Really sounds like a component issue that I have had in the past. components export to the first frame of your movie and load before everything else. - even your preloader. Here is how I have been working around this issue. Create a new FLA that is the same size as the .swf that you want to load. Name it preloader On the first keyframe of preloader add loadbar with and instance name of "loadbar" and a dynamic text feild with an Var name of "percent_display"
also add this actionscript to the first keyframe of preloader.fla
read the comments within the actionscript which describe what it is doing
code:
/* First thing to do is set the stage size of
this movie at the same size as your
"to be loaded" movie, and re-position the display
elements to your liking.
Also set the same framerate as your movie.
Then replace "YourFlash.swf" in 2 of the lines below,
with the name of your movie.
Last, make sure your present movie is cleared
of any preloader, and most importantly, that it
starts off with a first blank keyframe.
*/
// Hides displayed elements
this.loadbar._visible = false;
percent_display = "";
//create a new movieclip to load
//the external movie into
this.createEmptyMovieClip("container",10);
//load the external movie into the new movieclip
container.loadMovie("YourFlash.swf");
//check the download status of the external
//movie once every frame
this.onEnterFrame=function(){
//trace the percentage of the movie that has loaded
percent=(this.container.getBytesLoaded()/this.container.getBytesTotal())*100;
if(!isNan(percent)){
// trace(percent+"% loaded");
if (percent == 0) {
percent_display = "";
} else {
percent_display = Math.ceil(percent) + "% LOADED.";
}
this.loadbar._visible = true;
this.loadbar._xscale = percent;
if (percent > 1) {
this.reelmc._visible = true;
}
container.stop();
} else {
// trace("0% loaded");
}
if(percent == 100){
delete this.onEnterFrame;
percent_display = "";
this.loadbar._visible = false;
loadMovieNum("YourFlash.swf",0);
}
}
stop();
-
ahh, I know what you're saying, but I tried and can't get it to work... are my files wrong?
-
here's the file i'm trying to have shown preloading.. and yes, there is a blank key frame in the first frame.
-
I think sound is another reason preloaders start late.
-
can anyone point me to a tutorial on how to create an external preloader? thanks
-
The code posted by Dickson is mine and works fine (except your loadbar which you've tampered with...) when I load my own movie. Tried to run your pagetest3.swf, but it seems to have no content...
Can you make the .fla available, so I can have a look at your setup?
-
well, i COULD, but I'm a little confused. The flash movie only contains a 100 kb mp3 file, nothing else... but it's 2.7 mb in size! after putting it into a zip, it's 2.1 mb. I'm really confused. If I can figure out why it's so big, I can compress it and make it available. hmmm....
-
Oh! Didn't realized it was only a sound file, didn't have my speakers opened... Let me check it again...
-
Well after correcting your loadbar bit, it works fine for me...
Have a look... Of course it's only a 57KBs sound movie, so on a fast connection it loads pretty fast. I've also coded it so that it appears on each test (on a refresh or re-load...), rather than using the cached file, just so that you could always see the preloader in action...
http://blake.prohosting.com/~tektips.../preloader.swf
-
haha, is there anyway you could share HOW you fixed it? thanks newbie
-
Fixed what? I didn't change anything except the loadbar bit, and that didn't have any effect on the preloading code itself...
Note that you can't really test this thing locally. You need to upload it online to test it... And as I said, it was originally designed to not show up when the file is already cached.
-
you said you "corrected" it, I was just wondering what was "wrong." thanks anyway
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|