# Problem in class

**URL:** <https://forum.kirupa.com/t/problem-in-class/289397>\
**Category:** Uncategorized\
**Created:** [May 29, 2009, 7:28pm UTC](https://forum.kirupa.com/t/problem-in-class/289397 "2009-05-29T19:28:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aminmix](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@aminmix](https://forum.kirupa.com/u/aminmix)\
**Post date:** [May 29, 2009, 7:28pm UTC](https://forum.kirupa.com/t/problem-in-class/289397/1 "2009-05-29T19:28:28Z")

</div>

Hi  
I want to use a variable that i have defined it in my class in onEnterFrame condition in a function in same class , but when i trace it , i face with undefined .  
is there anyone can help me? if you know how to do this ,please correct the attached file and uploade it here , thank you so much

```auto

class Harekat extends MovieClip {
	private var myVar:String="Hello";
	public function Shetab():Void {
		_root.onEnterFrame = function() {
			trace(myVar); // output is undefined
		};
	}

}

```
