# Using set and eval functions setting variables

**URL:** https://forum.kirupa.com/t/using-set-and-eval-functions-setting-variables/188984
**Category:** flash
**Created:** [May 12, 2006, 10:56am UTC](https://forum.kirupa.com/t/using-set-and-eval-functions-setting-variables/188984 "2006-05-12T10:56:03Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![daffy\_dowden](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/daffy_dowden/32/2371_2.png) [@daffy\_dowden](https://forum.kirupa.com/u/daffy_dowden)
#### Post date: [May 12, 2006, 10:56am UTC](https://forum.kirupa.com/t/using-set-and-eval-functions-setting-variables/188984/1 "2006-05-12T10:56:03Z")

</div>

Hi all,  
I’m having problems in setting three variables using a for loop and then passing these variables to my function. I think it’s something to do with the set function I’m using, because my colorFadeTo function claims it’s being passed an undefined variable.  
Can anyone lend a hand?

```auto

for (var i=0; i<circles.length; i++) {
    var current = circles*;
    set (eval("colorVarAsp"+i), new Color(current.background_mc));
    
    current.onRollOver = function():Void {
        eval("colorVarAsp"+i).setRGB(0x003399);
        trace("colorVarAsp"+i)
        colorFadeTo(eval("colorVarAsp"+i));
    };
    current.onRollOut = function():Void {;
        colorFadeAway(eval("colorVarAsp"+i));
    };
    current.onRelease = function():Void {
        trace("circle: "+this);
    };
};

```

Cheers!  
:red:
