# Code not working

**URL:** <https://forum.kirupa.com/t/code-not-working/306090>\
**Category:** Uncategorized\
**Created:** [March 9, 2010, 1:59pm UTC](https://forum.kirupa.com/t/code-not-working/306090 "2010-03-09T13:59:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gwh](https://avatars.discourse-cdn.com/v4/letter/g/bbe5ce/32.png) [@gwh](https://forum.kirupa.com/u/gwh)\
**Post date:** [March 9, 2010, 1:59pm UTC](https://forum.kirupa.com/t/code-not-working/306090/1 "2010-03-09T13:59:01Z")

</div>

Hi everyone,

I have the following preloader code:

```auto
stop();

CheckProgress = setInterval(getPercent, 10);

function getPercent() {
	var currentBytes = _root.getBytesLoaded();
	var totalBytes = _root.getBytesTotal();
	var pctLoaded = Math.round(currentBytes/totalBytes*100);
	pct_txt.text = pctLoaded + "%";
	
	if(pctLoaded >= 100) {
		gotoAndStop(2);
		clearInterval(checkProgress);
	}
	
}

```

When the code checks to see if it’s finished loading, ie:

```auto
if(pctLoaded >= 100) {
                gotoAndStop(2);
                clearInterval(checkProgress);
        }

```

…it tells the playhead to go to frame 2, ie.

gotoAndStop(2);

There is a movieclip on this frame and inside, on its own timeline, there’s the following on the last frame:

\_parent.nextFrame();

This tells the playhead to move to frame 3 on the root timeline which again contains another movie clip.

When I test, after the preloader has done it’s work, it moves to frame 2 and plays the mc but after that it doesn’t move to frame 3. It just loops the mc on frame 2.

It worked successfully before I put the preloader code in place, so I’m assuming it has something to do with that.

I wondered if anyone knows what might be happening?

Appreciate any help.
