# Preloader continuing after 50%

**URL:** <https://forum.kirupa.com/t/preloader-continuing-after-50/63512>\
**Category:** flash\
**Created:** [September 7, 2004, 3:25pm UTC](https://forum.kirupa.com/t/preloader-continuing-after-50/63512 "2004-09-07T15:25:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![marc0047](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@marc0047](https://forum.kirupa.com/u/marc0047)\
**Post date:** [September 7, 2004, 3:25pm UTC](https://forum.kirupa.com/t/preloader-continuing-after-50/63512/1 "2004-09-07T15:25:10Z")

</div>

I am using the following code to create my preloader. However, when I use the debugger I notice that it will perform ‘gotoAndStop(2)’ almost immediately after 50% loaded, instead of 100% loaded. I’ve used a variation of this code before and it performs correctly. Might I be missing something?

Frame 1:  
stop();  
bytes\_loaded = Math.round(this.getBytesLoaded());  
bytes\_total = Math.round(this.getBytesTotal());  
if (bytes\_loaded == bytes\_total) {  
gotoAndStop(2);  
} else {  
gotoAndPlay(1);  
}

Frame 2:  
stop();  
trace(“begin movie”);

---

<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 7, 2004, 5:42pm UTC](https://forum.kirupa.com/t/preloader-continuing-after-50/63512/2 "2004-09-07T17:42:16Z")

</div>

Frame 2:  
stop();  
bytes\_loaded = Math.round(this.getBytesLoaded());  
bytes\_total = Math.round(this.getBytesTotal());  
if (bytes\_loaded == bytes\_total) {  
gotoAndStop(3);  
} else {  
gotoAndPlay(1);  
}

Frame 3:  
stop();  
trace(“begin movie”);

---

<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 8, 2004, 3:30am UTC](https://forum.kirupa.com/t/preloader-continuing-after-50/63512/3 "2004-09-08T03:30:21Z")

</div>

Thanks, that worked. Is there a particular explanation as to why gotoAndPlay(1), or current frame running, doesn’t properly load the entire movie?

---

<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 8, 2004, 6:24pm UTC](https://forum.kirupa.com/t/preloader-continuing-after-50/63512/4 "2004-09-08T18:24:46Z")

</div>

flash thinks its clever (at least this is my interpretation)

if it reads a goto action that would mean re loading the current frame it thinks its going to run into an endless cycle hence it thinks “well im already here… might as well carry on then!”

just use for loops or 2frame loops…

Prophet.

---

<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 8, 2004, 6:29pm UTC](https://forum.kirupa.com/t/preloader-continuing-after-50/63512/5 "2004-09-08T18:29:34Z")

</div>

Oh? I don’t think I’ve seen a nice for loop preloader. Please point me in the right direction!

---

<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 8, 2004, 6:53pm UTC](https://forum.kirupa.com/t/preloader-continuing-after-50/63512/6 "2004-09-08T18:53:41Z")

</div>

i havent either - just a thought that popped into my head just now…  
think it might loop too frequently for a preloader and hence slow the computer down… but we can always try iguess…

Prophet.
