I am new to AS 3.0, but have programmed extensively in AS 2.0. I have 3 checkboxes on my stage, each of which correspond to a specific boolean variable. I am trying to create a single eventListener function to handle them. In AS 2, I was able to take the name of the checkbox that was clicked and use eval to allow me set the appropriate boolean value. However, when I try to do this in AS 3, it tells me that eval is an undefined method. Is there a simple way to take the name of an object on the stage and get it's appropriate variable?

Here's what I'm talking about:

I have 3 checkboxes named count_mc, placement_mc, and spray_mc and 3 boolean variables called count, placement and spray. In the past, I could get the name of the movieclip that was clicked, strip off the _mc and place that string in an eval statement as follows:

var btnClicked = event.target.name.substring(0, event.target.name.indexOf("_mc"));
btnVar = eval(btnClicked);
btnVar = !btnVar;

I appreciate any help anyone can give me.


Chris