# Delete attachMovie

**URL:** <https://forum.kirupa.com/t/delete-attachmovie/286274>\
**Category:** Uncategorized\
**Created:** [April 13, 2009, 7:29am UTC](https://forum.kirupa.com/t/delete-attachmovie/286274 "2009-04-13T07:29:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel\_mihalcea](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@daniel\_mihalcea](https://forum.kirupa.com/u/daniel_mihalcea)\
**Post date:** [April 13, 2009, 7:29am UTC](https://forum.kirupa.com/t/delete-attachmovie/286274/1 "2009-04-13T07:29:39Z")

</div>

Hello. I have a function that is attaching something in a column depending on a number I am giving. If I press on that attachment I what to delete that something from the stage.  
I have like this:  
1  
2  
3  
4  
5  
6  
I press 5 I what to remove 5 from the column.  
This is my function. Thank you for any help.  
function buildDeleteButtons(k:Number, parentMovie:MovieClip) {  
parentMovie.\_x = 0;  
parentMovie.\_y = 25;  
for (var i:Number = 0; i \< k; i++) {  
var currentDeleteButton:MovieClip = parentMovie.attachMovie(“trashcan”, “myButton” + (i+1), parentMovie.getNextHighestDepth());  
currentDeleteButton.id = i;  
currentDeleteButton.\_x = 5;  
currentDeleteButton.\_y = i\*(currentDeleteButton.\_height + 5) + 5;  
currentDeleteButton.onRelease = function() {  
trace(this.id);  
trace(currentDeleteButton);  
}  
}
