# ChangeHandler for checkboxes on MC

**URL:** https://forum.kirupa.com/t/changehandler-for-checkboxes-on-mc/43003
**Category:** flash
**Created:** [February 17, 2004, 9:38pm UTC](https://forum.kirupa.com/t/changehandler-for-checkboxes-on-mc/43003 "2004-02-17T21:38:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![lunatic](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@lunatic](https://forum.kirupa.com/u/lunatic)
#### Post date: [February 17, 2004, 9:38pm UTC](https://forum.kirupa.com/t/changehandler-for-checkboxes-on-mc/43003/1 "2004-02-17T21:38:00Z")

</div>

Howdy all,

Okay so I have some checkboxes that make MCs visible or invisible. I put all my MCs into an array and all the checkbox instance names an array and used the following code (the ChangeHandler function is called showHideShape):  
[AS]  
function ShowHideShape() {  
var c;  
for (c in checkbox) {  
mainMap.map.pan.mapElements[objects[c]].\_visible = checkbox[c].getValue();}  
}  
[/AS]

This all works great. However, now I need to move all the checkboxes onto their own little MC and for the life of me I can’t figure out how to modify the above to make it work. I tried including the MC name in front of all the checkbox instance names in the array (e.g. checkbox = [MC.cb1, MC.cb2, MC.cb3]) but that didn’t work. I also tried  
[AS]  
function ShowHideShape() {  
var c;  
for (c in checkbox) {  
mainMap.map.pan.mapElements[objects[c]].\_visible = MC[checkbox[c]].getValue();}  
}  
[/AS]

but that doesn’t work either.

What am i missing here? :trout: Any ideas? :beam:

---

<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: [February 19, 2004, 11:50pm UTC](https://forum.kirupa.com/t/changehandler-for-checkboxes-on-mc/43003/2 "2004-02-19T23:50:14Z")

</div>

Hmmmm, still trying to figure this out. I tried a couple more tweaks but nothing seems to get those checkboxes noticed. Anyone have a clue? (-:

---

<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: [February 20, 2004, 1:52am UTC](https://forum.kirupa.com/t/changehandler-for-checkboxes-on-mc/43003/3 "2004-02-20T01:52:13Z")

</div>

What if you create the function on the timeline of the mc with the checkboxes in it? Then use \_parent.

Or define the function using the onLoad handler, directly on MC. Then use the “this” keyword, eg.  
[AS]  
onClipEvent(load){  
function ShowHideShape() {  
var c;  
for (c in checkbox) {  
mainMap.map.pan.mapElements[objects[c]].\_visible = this[checkbox[c]].getValue();}  
}  
}  
[/AS]

I kind of stabbing at what I think you are trying to do. I’d know if I were talking through my hat if you posted and fla.
