package
{
import flash.display.*;
import flash.events.*;
public class player extends MovieClip
{
public function player(){}
public function init()
{
var hp:int = 100;
var lives:int = 3;
var current_weapon:int = 1;
stage.addEventListener(KeyboardEvent.KEY_DOWN,enterKey);
trace("done");
}
private function enterKey(e:KeyboardEvent)
{
trace("here");
}
}
}
on the main timeline i have a MC called “game”, inside it i am dynamically attaching the “player” mc, and the above code is the code of that player. But now the problem is, when i use the above way, everything works fine, but if i use addEventListener instead of stage.addEventListener, “here” isn’t being traced…why?
I mean whether i attach the listener to the mc “player” or the stage shouldn’t matter, right? sorry, i am totally confused here…