# Can't set properties from instances of my class

**URL:** <https://forum.kirupa.com/t/cant-set-properties-from-instances-of-my-class/322946>\
**Category:** flash\
**Created:** [June 10, 2011, 12:30am UTC](https://forum.kirupa.com/t/cant-set-properties-from-instances-of-my-class/322946 "2011-06-10T00:30:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sogj](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sogj/32/3189_2.png) [@sogj](https://forum.kirupa.com/u/sogj)\
**Post date:** [June 10, 2011, 12:30am UTC](https://forum.kirupa.com/t/cant-set-properties-from-instances-of-my-class/322946/1 "2011-06-10T00:30:52Z")

</div>

I have a class - call it MyClass - and an instance of that class with instance name myObject.

In MyClass I declare:

public var myVariable:Number;

In the main timeline I try to set it using myObject.myVariable = 3;

In the main timeline, if I do a trace (myObject.myVariable) it will return 3. Within the class, if I do a trace of (this.myVariable) it returns null.

However, if I add a line of code in my class and add this.myVariable = 3, it traces 3.

What am I doing wrong? Why can’t I get myObject to correctly change its own parameters?

I’m new to AS3 so I’m sorry if I’m just getting something overly simple wrong. 😕
