-
The Metamorphic Mutant
I have a main fla file called home.fla with two scenes [preloader and scene 1.]
In the preloder scene I have two dynamic text fields one called "loadPercent" and the other called "loadBytes"
key frame 1 of the preloder scene I have this code:
loadpercent = "0%";
loadBytes = "0 of "+Math.round((_root.getBytesTotal()/1024)*1000)/1000+" Kb";
key frame 2 I have this code:
loadPercent = (Math.floor(_root.getBytesLoaded()/_root.getBytesTotal()*100)+"%");
loadBytes = (Math.round((_root.getBytesLoaded()/1024)*1000)/1000+" Kb of "+Math.round((_root.getBytesTotal()/1024)*1000)/1000+" Kb total Loaded.");
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
// Check for finished loading
// If loaded, final update to fields
loadPercent = "100%";
loadBytes = (Math.round((_root.getBytesLoaded()/1024)*1000)/1000+" Kb of "+Math.round((_root.getBytesTotal()/1024)*1000)/1000+" Kb total Loaded.");
gotoAndPlay("Scene 1", 1);
}
key frame 3 I have this code:
gotoAndPlay(2);
Now, when I display this in a browser it shows 0% loaded and then playes scene 1. It doesn't show 100%. Why is that? Is there something diffrent with the code?
Any help would be greatly appreciate it.
-
if (_root.getBytesLoaded() == _root.getBytesTotal()) {...
Try changing your above line to:
if (_root.getBytesLoaded()>0 && _root.getBytesLoaded >= _root.getBytesTotal()) {...
-
The Metamorphic Mutant
Nope... that didn't work. But thanks anyhow
-
What if you add a stop(); action to replace (for this testing!) your gotoAndPlay("Scene 1", 1); line?
Think this is so fast when tested locally, that you're simply not seeing the 100% mark!
Test it online, to see if you see lower percentages than 100% on the initial download.
Understand what I'm getting at?
-
newbie
That same code worked when I streamed a 95kb file.
-
The Metamorphic Mutant
I placed a stop action and then I viewed it streaming from the flash player and I noticed that it counted up to 100% but then it jumped from 100% back to 0%. Why is that?
-
newbie
Can you post a link to your swf file so we can see how it streams?
-
Works fine for me! Stays at 100%!
-
The Metamorphic Mutant
Originally posted by McFalski
Can you post a link to your swf file so we can see how it streams?
not at the moment... I'll see what I can do.
-
The Metamorphic Mutant
I put it here http://www.eforce.net/dcmedia_v4.html temporairly so you can see it streaming... it still shows up as 0% then it playes all of the swf files. This is realy starting to **** me off
-
No! Just checked it on my 56k dial-up (big files you have there!), and your preloader doesn't seem to be working properly, probably because you used components and/or export on first frame stuff (what about those sound files?).
I only see the initial preloader, and it doesnt show up until +/- 60% of bytes have downloaded. You'll have to create a new preloader movie as we've been discussing in this thread:
http://board.flashkit.com/board/show...hreadid=356040
On top of that, are you starting other loads in the background when your main movie starts playing?
Hotmail won't accept what I suspect as being quite large files, so if you want me to have a look, at your main movie's preloader at least, post a link to your uploaded .flas, or e-mail me a link to them.
You can do that by hitting the e-mail box at the bottom of this post.
-
The Metamorphic Mutant
Yes... they are preety big file because I use video and a lot of jpegs.
I'll try and see if I can save the files somewhere on my server. I'll e-mail you with the info.
Thanks
-
newbie
It worked for me
For me, the percentage started at around 90% and then 91,92... until 99. I don't see the 0% that you were talking about. BTW, oldnewbie's right about the components stuff, however that shouldn't be the reason why you are seeing 0%. Maybe you have a corrupted Flash Player. Try downloading a new one from Macromedia and see if the problem persists. (Make sure you do it the right way)
-
The Metamorphic Mutant
Oldnewbie... did you get the e-mail I send you with a link to the fla's?
Thanks
-
-
The Metamorphic Mutant
So... during my lunch break I went to Barnes & Nobles and spent $30 on this book:
http://search.barnesandnoble.com/boo...sbn=0201758466
Basicly it tells me to place a moviclip on the main timeline with a rectangle box *bar* to indicate the progressBar and a dynamic text field *myTextField* where my percent number will be displayed.
Sounds simple right?!.... Then, I have this code on keyfrome one:
stop();
myInterval = setInterval(preloader, 10);
function preloader() {
if (getBytesLoaded()>=getBytesTotal()) {
play();
clearInterval(myInterval);
}
bar._xscale = (getBytesLoaded()/getBytesTotal())*100;
myTextField.text = Math.round(getBytesLoaded()/getBytesTotal()*100)+"%";
}
Basicly the movie starts on the second keyframe.
Now, I have a diffrent problem... the dynamic text box called "myTextField" doesn't show the number of percent loading until it reaches 98% and then it starts to count off 98, 99, and finally 100.
Why the delay?
I swear I'm going back to flash 5 because of this!!!!!! AAARRRRRRrrrrrrr
-
newbie
When you use Macromedia's components, it's 'exported on the first frame'. That means all the data of the components you are using in the movie are stored on the first frame of the movie. (even though you won't use the text scroller until the last frame of your movie) This causes many problems because your preloader is on your first frame too, and as a result your preloader will not show up (a blank screen does) when people are downloading the components. (the components usually takes up quite a bit of space).
Say if you have a text ScrollBar component on the 20th frame of you movie, and a preloader on the first 2 frames, people would have to download the ScrollBar component(21KB) before they download the preloader(1KB). That is why you are seeing nothing for quite a time before the preloader kicks in. (By which time, the movie's probably half loaded)
The solution, as oldnewbie pointed out, is to have an external preloader. Follow his link and read that thread. However you may want to make a few changes to his script to make it work correctly. (BTW, oldnewbie, your preloader has a bug.)
[Edited by McFalski on 08-20-2002 at 04:35 PM]
-
The Metamorphic Mutant
Yes... but I need it to load other swf files into the main timeline
Although... it's very clever... His solution can only be used once.
-
...(BTW, oldnewbie, your preloader has a bug.)
Care to share?
Never pretender it was perfect! And it was never intended, as coded, to be a generic preloader in the first place!
-
newbie
From your preloader, the movie would start playing before it's finished loading. If there is a 21KB component on the first frame and the rest of the movie is 400KB, then your preloader would start playing after it loads the 21KB and frame 2, but frame 3+ are still not loaded yet:
if (LoadedBytes != TotalBytes) {
//put something here that prevents the movie from playing before it's loaded.
//I don't know if container.stop() can do it, but most likey, it would still show the first frame.
}
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
|