# Buttons, can they affect layers?

**URL:** https://forum.kirupa.com/t/buttons-can-they-affect-layers/381
**Category:** Uncategorized
**Created:** [July 16, 2002, 1:30am UTC](https://forum.kirupa.com/t/buttons-can-they-affect-layers/381 "2002-07-16T01:30:09Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![nstravinsky](https://avatars.discourse-cdn.com/v4/letter/n/f4b2a3/32.png) [@nstravinsky](https://forum.kirupa.com/u/nstravinsky)
#### Post date: [July 16, 2002, 1:30am UTC](https://forum.kirupa.com/t/buttons-can-they-affect-layers/381/1 "2002-07-16T01:30:09Z")

</div>

Can i make a button, when pressed, cause a layer to become visible or invisible?  
If so, how?

thanks

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 16, 2002, 3:07am UTC](https://forum.kirupa.com/t/buttons-can-they-affect-layers/381/2 "2002-07-16T03:07:02Z")

</div>

What you are thinking of I don’t believe is possible, but I think I have an alternate solution. If possible take everything in the layer that you want to be invisble, convert the contents of that layer to a movieclip. Then the code is simple.

on(release)  
\_root.layerClip.\_visible = false

This should help and it allows you to make the movieclip visible or invisible when every you want or after certain conditions are met.

Kyle

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 16, 2002, 4:35am UTC](https://forum.kirupa.com/t/buttons-can-they-affect-layers/381/3 "2002-07-16T04:35:22Z")

</div>

No need to transform everything into a movie clip. Just give everything you want to turn invisible an instance name, and set them \_visible = 0 ;

pom :asian:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 16, 2002, 3:03pm UTC](https://forum.kirupa.com/t/buttons-can-they-affect-layers/381/4 "2002-07-16T15:03:32Z")

</div>

Oops, your right Ilyaslamasse I keep forgeting about Flash Mx and its ability to give everything an instance name. I guess I was still in Flash 5 mode when I posted. Thanks that helped the both of us I think.

Kyle

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 16, 2002, 5:54pm UTC](https://forum.kirupa.com/t/buttons-can-they-affect-layers/381/5 "2002-07-16T17:54:01Z")

</div>

I have two background bitmaps turned into movieclips (Background1, Background2)

They are on 2 seperate layers. I then have a buttons with this code:

on(release) {  
Background2.\_visible = false;  
}

Why doesn’t Background2 hide, so I can see Background1 on the layer beneath?

I even tried giving Background2 the instance name Backg2 and changing the code to:  
on(release) {  
Backg2.\_visible = false;  
}

Neither works. What am I overlooking?

Thanks

RR
