# Eval and \[\] differences (looping fct)

**URL:** <https://forum.kirupa.com/t/eval-and-differences-looping-fct/266920>\
**Category:** Uncategorized\
**Created:** [July 25, 2008, 4:01pm UTC](https://forum.kirupa.com/t/eval-and-differences-looping-fct/266920 "2008-07-25T16:01:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![blirette](https://avatars.discourse-cdn.com/v4/letter/b/ee7513/32.png) [@blirette](https://forum.kirupa.com/u/blirette)\
**Post date:** [July 25, 2008, 4:01pm UTC](https://forum.kirupa.com/t/eval-and-differences-looping-fct/266920/1 "2008-07-25T16:01:11Z")

</div>

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 :

```auto

        // 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! 🙂
