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]
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.
Thanks! I’ll give that a whirl. I actually have several MCs that will have checkboxes on them so having everything on the main timeline was a nice way of keeping them together. But I think you are right - I’ll just have to repeat the function on the timelines of the MCs. Or maybe I’ll take a stab at a prototype function. Those are awesome but not my forte.
I’d post my fla but it’s enormous and cumbersome (it’s built for CD rather than web) so I’ll avoid that unless I can’t help it.