# Problems with eval

**URL:** <https://forum.kirupa.com/t/problems-with-eval/202522>\
**Category:** flash\
**Created:** [October 2, 2006, 1:45pm UTC](https://forum.kirupa.com/t/problems-with-eval/202522 "2006-10-02T13:45:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SlowRoasted](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@SlowRoasted](https://forum.kirupa.com/u/SlowRoasted)\
**Post date:** [October 2, 2006, 1:45pm UTC](https://forum.kirupa.com/t/problems-with-eval/202522/1 "2006-10-02T13:45:02Z")

</div>

Why isn’t this working? It is just some simple button code to keep track of what section I have alpha’ed up. When I trace currContents it says undefined.

```auto

var currContents:String = "contents";

with(buttons) {
        b2.onRelease = function() {
		if(_root.currContents != "contents2"){
			var button2:Tween = new Tween(eval(_root.currContents), "_alpha", Strong.easeOut, 100, 0, .4, true);
			_root.currContents = "contents2";
			trace(eval(_root.currContents));
			button2.onMotionFinished = function() {
				var button2:Tween = new Tween(_root.contents2, "_alpha", Strong.easeOut, 0, 100, .4, true);
			};
		}
	};
}

```
