# Start into Classes and references to Variables

**URL:** <https://forum.kirupa.com/t/start-into-classes-and-references-to-variables/313552>\
**Category:** flash\
**Created:** [September 2, 2010, 1:28pm UTC](https://forum.kirupa.com/t/start-into-classes-and-references-to-variables/313552 "2010-09-02T13:28:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeeto](https://avatars.discourse-cdn.com/v4/letter/z/e274bd/32.png) [@zeeto](https://forum.kirupa.com/u/zeeto)\
**Post date:** [September 2, 2010, 1:28pm UTC](https://forum.kirupa.com/t/start-into-classes-and-references-to-variables/313552/1 "2010-09-02T13:28:54Z")

</div>

Hi Guys,

Long time ago I’ve been creating some as 2.0 projects, all of them based on the code within the timeline.  
I wanted to start learning as 3.0 based on classes rather on timeline but I find it confusing and difficult to understand introduction into the classes.

I can’t get to understand why the following example is not working :

I’ve got 3 files:

**main.fla** with main class “ **Main** ”

```auto

no code

```

**Main.as**

```auto
 
package  
 {
 import flash.display.MovieClip;
 import projectconfig.Configurator;
 
 public class Main extends MovieClip 
 {
 var projectConfigurator:Configurator;
  
  public function Main():void 
  {
   projectConfigurator = new Configurator();
[COLOR=#ff0000] trace(projectWidth);[/COLOR]
  }
 }
}

```

**Configurator.as**

```auto
 
package projectconfig 
 {
 
 public class Configurator 
 {
  var projectWidth:uint = 1200;
  trace("Configurator loaded");
[COLOR=red] trace(projectWidth);[/COLOR]
 }
}

```

Can anybody help me out how to use value of “projectWidth” from **Configurator** class in the **Main** class?

The [COLOR=red]code in red[/COLOR] doesn’t work and I can’t work it out why.

I’ve noticed that if I recode \*\*Configurator.as \*\*this way:

```auto
 
package projectconfig 
 {
 
 public class Configurator 
 {
  var projectWidth:uint = 1200;
  trace("Configurator loaded");
  [COLOR=blue]public function Configurator() {[/COLOR]
[COLOR=red] [/COLOR][COLOR=black]trace(projectWidth);[/COLOR]
[COLOR=blue] }
[/COLOR] }
}

```

[COLOR=blue]Changes in blue[/COLOR] - then the **Configurator.as** traces \*\*projectWidth \*\*value, but still I can’t use it in **Main.as**.

Thanks
