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.
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.