Eval replacement in AS3

var currentPage=“contentHome_mc”;

contentHome_mc.gotoAndPlay(“on”);

//Functions
function animateOn(page:String) {
eval(page).gotoAndPlay(“on”);
}

function animateOff(page:String) {
eval(page).gotoAndPlay(“off”)
}

function onHomeclick(evt:MouseEvent) {
if (currentPage != “contentHome_mc”) {
animateOff(currentPage);
animateOn(“contentHome_mc”);
currentPage=“contentHome_mc”;
}
}

function onAboutclick(MouseEvent) {
if (currentPage!= “contentAbout_mc”) {
animateOff(currentPage);
animateOn(“contentAbout_mc”);
currentPage=“contentAbout”;
}
}

function onProductsclick(MouseEvent) {
if (currentPage!= “contentProducts_mc”) {
animateOff(currentPage);
animateOn(“contentProducts_mc”);
currentPage=“contentProducts”;
}
}

//Menu Button actions
home_mc.addEventListener(MouseEvent.CLICK, onHomeclick);
products_mc.addEventListener(MouseEvent.CLICK, onProductsclick);
about_mc.addEventListener(MouseEvent.CLICK, onAboutclick);

hey guys can anyone help me out please ? i am watching the learnflash building a flash site with flash 8 video and i am trying to make the exact things but instead of actionscript 2 with AS3.so far i did great but now that the functions and variables started gettind involved for lots actions it seems that there are many dieferences…

what can i put instead of the “eval” so i can havce the same result as the eval ??? everything else works just that. please tell me how to do it…

if you didn’t understand my problem is how can i make the variable of the function gets a value from the event listeners…and convert the string it gets to a code so to complete the function!