Why Lib.current.stage
gives me this error:
src/Main.hx:43: characters 2-35 : openfl.display.DisplayObject cannot be called
Edit: I have tried the following code.
Lib.current.stage.addEventLitener(
KeyboardEvent.KEY_DOWN,
function(e:KeyboardEvent) {
if (e.keyCode == Keyboard.W) up = true;
if (e.keyCode == Keyboard.A) left = true;
if (e.keyCode == Keyboard.D) right = true;
if (e.keyCode == Keyboard.S) down = true;
}
);
I think MovieClip implements Dynamic<MovieClip>
so that any reference not in the class definition is assumed to be a MovieClip.
You've got a typo there on addEventLitener, missing an 's' which isn't in the class definition, so is assumed to be a MovieClip, which cannot be called.