I’m trying my hardest to understand ActionScript 3, and I follow the tutorials all well and good, but when it comes to creating my own files, I keep hitting this error when compiling:
TypeError: Error #1007: Instantiation attempted on a non-constructor.
at Main$iinit()
What on earth does it mean? what have I done wrong? my Main.as code is as follows:
package {
import flash.display.*;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.ui.Mouse;
public class Main extends MovieClip {
private var cursorA:MovieClip = new MovieClip();
public function Main() {
cursorA = new cursorA();
this.addChild(cursorA);
stage.addEventListener(Event.MOUSE_LEAVE, cursorHide);
stage.addEventListener(MouseEvent.MOUSE_MOVE, cursorFollow);
Mouse.hide();
}
public function cursorHide(evt:Event):void {
cursorA.visible = false;
}
public function cursorFollow(evt:MouseEvent):void {
if (!cursor.visible) cursorA.visible = true;
cursorA.x = stage.mouseX;
cursorA.y = stage.mouseY;
evt.updateAfterEvent();
}
}
}
I’ve got 2 movieclips in the library, and i’ve the linkage stuff (only referred to cursorA in the class though)