# I need help with some actionscript coding

**URL:** <https://forum.kirupa.com/t/i-need-help-with-some-actionscript-coding/220667>\
**Category:** flash\
**Created:** [March 28, 2007, 5:35am UTC](https://forum.kirupa.com/t/i-need-help-with-some-actionscript-coding/220667 "2007-03-28T05:35:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fileslasher](https://avatars.discourse-cdn.com/v4/letter/f/4da419/32.png) [@fileslasher](https://forum.kirupa.com/u/fileslasher)\
**Post date:** [March 28, 2007, 5:35am UTC](https://forum.kirupa.com/t/i-need-help-with-some-actionscript-coding/220667/1 "2007-03-28T05:35:54Z")

</div>

Hey all. Nice forums. I’m having some trouble with actionscript. I need to be able to have an on press or on release event for a button that deletes or removes all object instances but I don’t know the code to do that.

Example: 4 frames.  
frame1 contains my variables with counters and functions to randomly generate a number of 2 different object instances.  
Frame2 calls those functions and generates instances.  
Frame 3 has some basic if else statements.  
Frame 4 has a button that will erase the existing instances and go to frame 2 to repeat the generation. This is the problem, I cant figure out what code to use to erase the instances with the button.

Any advice or suggestions would really help me out. If you want to see my code, reply and I will post it.  
I’m using mx pro 2004 ver 7.0

Thanks all.

_edit_ sorry, I missed the actionscript forum. my bad.
