# Clearing everything and re-loading

**URL:** <https://forum.kirupa.com/t/clearing-everything-and-re-loading/291878>\
**Category:** Uncategorized\
**Created:** [July 7, 2009, 2:32am UTC](https://forum.kirupa.com/t/clearing-everything-and-re-loading/291878 "2009-07-07T02:32:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tedri\_Mark](https://avatars.discourse-cdn.com/v4/letter/t/51bf81/32.png) [@Tedri\_Mark](https://forum.kirupa.com/u/Tedri_Mark)\
**Post date:** [July 7, 2009, 2:32am UTC](https://forum.kirupa.com/t/clearing-everything-and-re-loading/291878/1 "2009-07-07T02:32:01Z")

</div>

Hey there, I’m making a gallery, with seperate xml pages for each set of images.

In a simplistic view, what I want to do is when the ‘previous’ or ‘next’ button is pressed, increase or decrease the page number by 1, which is easy enough, and start afresh…

I though it should be a case of removing all the children from the scene and then executing the functions at the start of the script, after all the variables have been set.

However, when I do this, I get the following error:

> ## [Tweener] Error: : [object preloaderMain\_12] raised an error while executing the’onComplete’handler.

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.  
at flash.display::DisplayObjectContainer/removeChild()

Any ideas?
