# Classes and functions

**URL:** https://forum.kirupa.com/t/classes-and-functions/328726
**Category:** flash
**Created:** [June 10, 2012, 11:02pm UTC](https://forum.kirupa.com/t/classes-and-functions/328726 "2012-06-10T23:02:49Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Pankly](https://avatars.discourse-cdn.com/v4/letter/p/59ef9b/32.png) [@Pankly](https://forum.kirupa.com/u/Pankly)
#### Post date: [June 10, 2012, 11:02pm UTC](https://forum.kirupa.com/t/classes-and-functions/328726/1 "2012-06-10T23:02:49Z")

</div>

Hi,  
I’m trying to learn AS3 and up till now every thing has been fine.  
When I write my code directly on the frame it works fine, but when I try and break it down into classes and functions on seperate .as files, I can’t seem to get it to work.

```auto
package { 
 
 import flash.display.MovieClip;
 
 
 public class unlockcheck extends MovieClip {         
  
  public var totalchars:Array = new Array();        
  public var unlockedchars:Array = new Array();
      
  public var char1:Object = new Object();
  char1.unlocked = true;
  totalchars.push(char1);
 
  public var char2:Object = new Object();
  char2.unlocked = true;
  totalchars.push(char2);
  
  public var char3 = new Object();
  char3.unlocked = false;
  totalchars.push(char3);
  
  public function unlockcheck() {                 
   for (var u:Number=0; u<totalchars.length;u++){ 
    if (totalchars[u]["unlocked"] == true){
    unlockedchars.push(totalchars[u]);
    }
   }
  }
 }     

} 

```

I get error 1120: access of undefined property for various lines when i run this. Now i’m not sure if theres a way that I’m supposed to be defining my Object properties that I’m not doing or what. Any help would be appreciated.
