View Full Version : check bytes code not workin ??
blah-de-blah
September 2nd, 2003, 09:32 AM
Ok so i have this code:
stop();
bytes_loaded = Math.round(_root.getBytesLoaded());
bytes_total = Math.round(_root.getBytesTotal());
if (bytes_loaded == bytes_total) {
gotoAndPlay("Scene 3", 1);
trace("scene 3");
} else {
gotoAndPlay("Scene 2", 1);
trace("scene 2");
}
and as you can see, all it does it check if bytes_loaded == bytes_total, if yes then go to scene 3 or else go to scene 2. But the problem is....its going to scene 2 no matter what :-\ I'm not sure whats wrong, anyone see anythin wrong with the code? thanks!! :P
jingman
September 2nd, 2003, 10:14 AM
Have you traced bytesLoaded and bytesTotal to see if they are even equal when the script runs?
stop();
bytes_loaded = Math.round(_root.getBytesLoaded());
bytes_total = Math.round(_root.getBytesTotal());
trace("bytesLoaded: "+_root.getBytesLoaded()+" bytesTotal: "+_root.getBytesTotal());
if (bytes_loaded == bytes_total) {
gotoAndPlay("Scene 3", 1);
trace("scene 3");
} else {
gotoAndPlay("Scene 2", 1);
trace("scene 2");
}
blah-de-blah
September 2nd, 2003, 10:38 AM
yea it seems to work fine when the thing hasn't been uploaded......but then after that it just messes up :-\
Voetsjoeba
September 2nd, 2003, 10:44 AM
I suppose you have a gotoAndPlay(2) action on the second frame ? The stop() action might be messing things up.
jingman
September 2nd, 2003, 10:44 AM
Well, if it works locally (where bytesLoaded actually can be true the first time you run the script), but not on a server - it may be the fact that no matter what you do, bytesLoaded will not equal bytesTotal right away (which is the only time your script runs, btw).
mlk
September 2nd, 2003, 10:56 AM
well you're telling flash to go to the second scene no matter what, so don't expect to have it loaded and going to the scenne 3...
Lemme explain; there is no loading ti;e when you check flash, which means bytes_loaded == bytes_total is true when you check it in flash (except if you try the bandwidth profiler)
however when you uploaded the swf bytes_loaded is always smaller than bytes_total at first, so it goes to scene 2 right away...
dya get what I mean ?
--you're telling flash to go to scene 2 if it's no totally loaded, and it does.
Voetsjoeba
September 2nd, 2003, 10:58 AM
Originally posted by mlkdesign
well you're telling flash to go to the second scene no matter what, so don't expect to have it loaded and going to the scenne 3...
Lemme explain; there is no loading ti;e when you check flash, which means bytes_loaded == bytes_total is true when you check it in flash (except if you try the bandwidth profiler)
however when you uploaded the swf bytes_loaded is always smaller than bytes_total at first, so it goes to scene 2 right away...
dya get what I mean ?
--you're telling flash to go to scene 2 if it's no totally loaded, and it does.
Lol, he's right :P I didn't even look at the else part :P The stop() should be removed too I think.
jingman
September 2nd, 2003, 12:02 PM
Originally posted by mlkdesign
well you're telling flash to go to the second scene no matter what, so don't expect to have it loaded and going to the scenne 3...
Lemme explain; there is no loading ti;e when you check flash, which means bytes_loaded == bytes_total is true when you check it in flash (except if you try the bandwidth profiler)
however when you uploaded the swf bytes_loaded is always smaller than bytes_total at first, so it goes to scene 2 right away...
dya get what I mean ?
--you're telling flash to go to scene 2 if it's no totally loaded, and it does.
Hehe, thanks for saying what I couldn't quite seem to get out.
blah-de-blah
September 3rd, 2003, 04:15 AM
Your explanation sounds good mlkman but i dont' really get it :-\
I understand that when the swf is uploaded on a website, the firrst time it will always go to scene 2, but after that it should be in the cache...therefore going straight to scene 3. But thats not workin too well or anythin. I'll try removing the stop(); in the meantime.....thanks!
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.