Hey, I’m having a little trouble with the properties of an instance of a specific class. Here’s and example of the code I am using:
package {
import flash.display.MovieClip;
import flash.events.*;
public dynamic class Circle1 extends MovieClip {
private var _root:Object;
public function Circle1() {
addEventListener(Event.ADDED_TO_STAGE, beginClass);
addEventListener(Event.ENTER_FRAME, eFrame);
}
private function beginClass(event:Event):void {
_root=MovieClip(root);
}
private function eFrame(event:Event):void {
this.x=_root.newCircle2.x;
this.y=_root.newCircle2.x;
}
}
This is in the class code for Circle1. Now here is the error that is being displayed int he Output Box when I try to run the file:
TypeError: Error #1010: A term is undefined and has no properties.
at Circle1/eFrame()
Here’s the code that creates the two class instances as children on the Main Time Line:
if (spaceDown) {
var newCircle1:Circle1=new Circle1();
addChild(newCircle1);
}
if (enterDown) {
var newCircle2:Circle2=new Circle2();
addChild(newCircle2);
}
enterDown is a defined variable for the key press of Enter, and spaceDown is a defined variable for the key press of Space. Is there something I’m doing wrong here?