I seem to have trouble getting a keyboard event within a class to work, I have an ENTER_FRAME event which works fine, but the keyboard event never gets called. Any ideas? here's the code
package
{
import flash.display.MovieClip;
import flash.display.Stage;
import flash.events.*;
public class mainGame extends MovieClip
{
var myPlayer:player = new player();
function mainGame():void
{
trace("arg!");
addChild(myPlayer);
addEventListener(KeyboardEvent.KEY_DOWN, keyDown);
addEventListener(Event.ENTER_FRAME, update);
}
function keyDown(evt:KeyboardEvent):void
{
trace("This never happens");
myPlayer.x++;
}
function update(evt:Event):void
{
trace("This happens fine");
}
}
}
thanks in advance!