# Alternative for eval \[\] in AS3?

**URL:** <https://forum.kirupa.com/t/alternative-for-eval-in-as3/225440>\
**Category:** Uncategorized\
**Created:** [May 11, 2007, 7:23pm UTC](https://forum.kirupa.com/t/alternative-for-eval-in-as3/225440 "2007-05-11T19:23:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![annettegeek](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@annettegeek](https://forum.kirupa.com/u/annettegeek)\
**Post date:** [May 11, 2007, 7:23pm UTC](https://forum.kirupa.com/t/alternative-for-eval-in-as3/225440/1 "2007-05-11T19:23:27Z")

</div>

How can I dynamically create object names (or functions) in a repeat loop, now that AS3 does not support the [] operator?

## For example, how would I do the following in AS3?

## [COLOR=blue]//create first column of text input objects [/COLOR] [COLOR=blue]for (i=1; i\<=7; i++) [/COLOR] [COLOR=blue]{ [/COLOR] [COLOR=blue]var yvalue= i\*30; [/COLOR] [COLOR=blue]this.createTextField([“mytext”+i], this.getNextHighestDepth(), 10, yvalue, 100, 22); [/COLOR] [COLOR=blue]this[“mytext”+i].border = true; [/COLOR] [COLOR=blue]this[“mytext”+i].type = “input”; [/COLOR] [COLOR=blue]this[“mytext”+i].tabIndex=i; [/COLOR] [COLOR=blue]}[/COLOR]

Or for creating onRelease or onRollover events for movie clips??

[COLOR=blue]for (i=1; i\<=myVar; i++) [/COLOR]  
[COLOR=blue]{  
this[“myButton”+i].onRollOver = function() [/COLOR]  
[COLOR=blue]{  
trace(“do stuff here”);[/COLOR]  
[COLOR=blue]}[/COLOR]  
[COLOR=blue]}[/COLOR]
