Check bytes code not workin?

Ok so i have this code:

[AS]
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”);
}
[/AS]

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!! :stuck_out_tongue:

Have you traced bytesLoaded and bytesTotal to see if they are even equal when the script runs?

[AS]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”);
}[/AS]

yea it seems to work fine when the thing hasn’t been uploaded…but then after that it just messes up :-\

I suppose you have a gotoAndPlay(2) action on the second frame ? The stop() action might be messing things up.

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).

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.

*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 :stuck_out_tongue: I didn’t even look at the else part :stuck_out_tongue: The stop() should be removed too I think.

*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.

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!