# Toggling an object on and off?

**URL:** <https://forum.kirupa.com/t/toggling-an-object-on-and-off/143990>\
**Category:** Uncategorized\
**Created:** [April 10, 2005, 8:18pm UTC](https://forum.kirupa.com/t/toggling-an-object-on-and-off/143990 "2005-04-10T20:18:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![psycosquirrel](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@psycosquirrel](https://forum.kirupa.com/u/psycosquirrel)\
**Post date:** [April 10, 2005, 8:18pm UTC](https://forum.kirupa.com/t/toggling-an-object-on-and-off/143990/1 "2005-04-10T20:18:23Z")

</div>

Hello

I am making my website in Flash, and have not met any problems until I tried to make a button that deletes several objects, all of which are Movie Clips and have the instance name of s1. The code in my button is very simple:

on (release) {  
delete s1;  
}

For some reason, it will not delete all of the objects, or any at all. I have tried changing the statement “delete s1;” to things such as “s1.\_alpha = 50;” to test it, but the objects are not responding. As I just started Flash yesterday, I do not know if I am violating any rules of ActionScript, or if I simply am forgetting to include something. Also, I am wondering if it would be possible to toggle the objects on and off. For example, when I hit the button they would all disappear and be deleted, then get reloaded when I hit the button again. Any input as to how to solve my problem or how to toggle the objects is appreciated.
