# Alternative for eval()

**URL:** <https://forum.kirupa.com/t/alternative-for-eval/233441>\
**Category:** Uncategorized\
**Created:** [July 24, 2007, 2:07am UTC](https://forum.kirupa.com/t/alternative-for-eval/233441 "2007-07-24T02:07:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrickjv](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@patrickjv](https://forum.kirupa.com/u/patrickjv)\
**Post date:** [July 24, 2007, 2:07am UTC](https://forum.kirupa.com/t/alternative-for-eval/233441/1 "2007-07-24T02:07:57Z")

</div>

I have AS2 situation -\> MC1 duplicates a MC2 in a keyframe three times. MC1’s parent has scale variables defined. MC1 sets \_yscale for the three new clips in AS2 with

for (j=1; j\<=3; j++) {  
setProperty(“dup”+j, \_yscale, eval("\_parent.Yscale"+j));  
}

I managed to convert most to AS3 except for the eval() part… which doesn’t exist in AS3… The closest I could guess to what i might be is something like;

dup[j].scaleY = MovieClip(parent).getDefinitionByName(“Yscale”+j);

but the substitute eval() part doesn’t work. FYI, I tried some random()\*10 values just to see result and that works fine. I mainly need to solve the part to work;

eval("\_parent.Yscale"+j)

Anybody a fix or alternative solution?
