# removeChild trouble!

**URL:** <https://forum.kirupa.com/t/removechild-trouble/315942>\
**Category:** flash\
**Created:** [November 8, 2010, 1:30pm UTC](https://forum.kirupa.com/t/removechild-trouble/315942 "2010-11-08T13:30:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jaman](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@Jaman](https://forum.kirupa.com/u/Jaman)\
**Post date:** [November 8, 2010, 1:30pm UTC](https://forum.kirupa.com/t/removechild-trouble/315942/1 "2010-11-08T13:30:17Z")

</div>

Aiaiaiai… my pre-loader ‘custom\_animation’ is on frame 1.

Once the pre-loader completed it jumps to frame 2 as you can see in the code below.

While navigating through my project (up to 65 frames) and the play-head reaches frame one again, the pre-loader appears and plays its animation.  
(Though it is actually not loading anything!)

Moving the play-head away from frame 1 and the pre-loader disappears again.  
Getting back to frame 1 and ONLY NOW the pre-loader won’t show again.

Question(s):  
Alias the pre-loader is removed only the 2nd time running the code below?  
Why does the movie-clip ‘custom\_animation’ appears once it is removed?  
How can I make sure it is removed once and for all after the project is loaded?

Please HELP!  
Thanks,  
Jaman

```auto

addEventListener(Event.ENTER_FRAME, loading);
function loading(event:Event)
{
	var bytestotal = stage.loaderInfo.bytesTotal;
	var bytesloaded = stage.loaderInfo.bytesLoaded;
	var sclbar = Math.round(bytesloaded * 100 / bytestotal);
	custom_animation.gotoAndPlay(sclbar);
	if (bytesloaded >= bytestotal)
	{
		gotoAndPlay(2);
		removeEventListener(Event.ENTER_FRAME, loading);
		removeChild(custom_animation);
	}
}

```
