# Rereading code

**URL:** <https://forum.kirupa.com/t/rereading-code/164528>\
**Category:** flash\
**Created:** [October 2, 2005, 11:15am UTC](https://forum.kirupa.com/t/rereading-code/164528 "2005-10-02T11:15:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Voursez](https://avatars.discourse-cdn.com/v4/letter/v/b5ac83/32.png) [@Voursez](https://forum.kirupa.com/u/Voursez)\
**Post date:** [October 2, 2005, 11:15am UTC](https://forum.kirupa.com/t/rereading-code/164528/1 "2005-10-02T11:15:51Z")

</div>

Ive got a little problem here. You can see im duplicating some movieClips, in a for loop. They have some XML values, but thats not important.

When i click one of the movieClips ive duplicated, ive set it to add one to the “length” variable. But i somehow need it to run though the code from start, when i press that button. And if its possible, to delete all the duplicates it made before. Thanks in advance.  
[AS]length = 2  
for (i = 0; i\<length; i++){  
duplicateMovieClip(button, “button”+i, i);  
setButton = \_root[“button”+i];  
if (answerCheck == ‘true’){  
setButton.onRelease = function(){  
length++;  
}  
}  
}[/AS]
