[haXe] Beginners-Question / KeyboardEvent does not fire
Adrian
nordbaer at gmail.com
Fri Jul 6 17:26:26 CEST 2007
Here is the lovely code:
------------------------------------------------------------
import flash.display.Sprite;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.Lib;
class Haupt extends Sprite{
private var ball:Sprite;
public function new() {
super();
}
static function main(){
var m:Haupt = new Haupt();
m.init();
}
private function init():Void{
ball = new Sprite();
Lib.current.addChild(ball);
ball.graphics.beginFill(0xff0000);
ball.graphics.drawCircle(0, 0, 40);
ball.graphics.endFill();
ball.x = Lib.current.width / 2;
ball.y = Lib.current.height / 2;
Lib.current.addEventListener(KeyboardEvent.KEY_DOWN,
onKeyboardEvent);
}
public function onKeyboardEvent(event:KeyboardEvent):Void{
trace("le key was pressed");
}
}
------------------------------------------------------------
Anybody can helpme?
Thanks alot!
greetings from here
adi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20070706/f4dae7aa/attachment.htm
More information about the Haxe
mailing list