I have a game engine class that inherits from MovieClipand handles mouseDown events in a private instance method. For simplicity, I call an event handler onMouseDown. It looks like this:
private function onMouseDown(e:MouseEvent):void
{
if (_isEnginePlaying)
{
_player.attack();
}
}
I will register it in the class method init(addToStage handler itself), which looks like this:
private function init(e:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
}
This compiles and works correctly, but the compiler warns:
Warning: 1090: Migration issue: the onMouseDown event handler does not automatically start Flash Player at run time in ActionScript 3.0. You must first register this handler for the event using addEventListener ('mouseDown', callback_handler).
, , , addEventListener(). , ?