addEventListener(Event.ADDED_TO_STAGE, onAdd); function onAdd(e: Event):void { removeEventListener(Event.ADDED_TO_STAGE, onAdd); stage.addEventListener(MouseEvent.MOUSE_MOVE, f); }