Eval and [] differences (looping fct)

Hey,

I’m not really good at figuring out how to do some things in Actionscript and I’m confused about looping throught functions with thins like eval. Here’s my code :


        // btn_05
        nombre = "05";
        if(eval("btn_"+nombre)._y == eval("intPosBtn"+nombre))
            {
            blnBtn05 = true;
            }
            else
            {
            if(eval("btn_"+nombre)._y < eval("intPosBtn"+nombre))
                {
                eval("btn_"+nombre)._y = eval("btn_"+nombre)._y + _global.intDeplacementBtn;
                }
                else if(eval("btn_"+nombre)._y > eval("intPosBtn"+nombre))
                {
                eval("btn_"+nombre)._y = eval("btn_"+nombre)._y - _global.intDeplacementBtn;
                };
            blnBtn05 = false;
            };

I’m trying to loop to dynamically create functions. I have 5 boutons and I don’t want to duplicate 5 times the same code. This code works but I don’t seem to be able to use the same eval trick on the variable “blnBtn05”.

Anyone knows why and how can I be make it work?

Thanks for your explanations! :slight_smile: