# Check bytes code not workin?

**URL:** <https://forum.kirupa.com/t/check-bytes-code-not-workin/29958>\
**Category:** Uncategorized\
**Created:** [September 2, 2003, 1:32pm UTC](https://forum.kirupa.com/t/check-bytes-code-not-workin/29958 "2003-09-02T13:32:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![blah\_de\_blah](https://avatars.discourse-cdn.com/v4/letter/b/a8b319/32.png) [@blah\_de\_blah](https://forum.kirupa.com/u/blah_de_blah)\
**Post date:** [September 2, 2003, 1:32pm UTC](https://forum.kirupa.com/t/check-bytes-code-not-workin/29958/1 "2003-09-02T13:32:52Z")

</div>

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!! 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 2, 2003, 2:14pm UTC](https://forum.kirupa.com/t/check-bytes-code-not-workin/29958/2 "2003-09-02T14:14:06Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 2, 2003, 2:38pm UTC](https://forum.kirupa.com/t/check-bytes-code-not-workin/29958/3 "2003-09-02T14:38:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 2, 2003, 2:44pm UTC](https://forum.kirupa.com/t/check-bytes-code-not-workin/29958/4 "2003-09-02T14:44:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 2, 2003, 2:44pm UTC](https://forum.kirupa.com/t/check-bytes-code-not-workin/29958/5 "2003-09-02T14:44:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 2, 2003, 2:56pm UTC](https://forum.kirupa.com/t/check-bytes-code-not-workin/29958/6 "2003-09-02T14:56:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 2, 2003, 2:58pm UTC](https://forum.kirupa.com/t/check-bytes-code-not-workin/29958/7 "2003-09-02T14:58:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 2, 2003, 4:02pm UTC](https://forum.kirupa.com/t/check-bytes-code-not-workin/29958/8 "2003-09-02T16:02:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 3, 2003, 8:15am UTC](https://forum.kirupa.com/t/check-bytes-code-not-workin/29958/9 "2003-09-03T08:15:30Z")

</div>

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!
