Permalink
Browse files

added cleanup of bindings on destroy and also added the keyCode to th…

…e callBacks if a callback has 2 arguments
  • Loading branch information...
1 parent 77fa32f commit 5d60bbed1b1d80364fffd89ee0807aeb63a1154e @hybridmindset committed Apr 3, 2011
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/com/pblabs/engine/core/InputMap.as
@@ -187,6 +187,11 @@ package com.pblabs.engine.core
PBE.inputManager.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
PBE.inputManager.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
PBE.inputManager.removeEventListener(KeyboardEvent.KEY_UP, onKeyUp);
+
+ for each( var action : String in _keymap)
+ {
+ if(_bindings.hasOwnProperty(action)) delete _bindings[action];
+ }
}
private function onKeyDown(event:KeyboardEvent):void
@@ -260,7 +265,10 @@ package com.pblabs.engine.core
return;
}
- callback(value);
+ if(callback.length == 2)
+ callback(value, keyCode);
+ else
+ callback(value);
}
private var _lastMouseX:Number = Number.NEGATIVE_INFINITY;

0 comments on commit 5d60bbe

Please sign in to comment.