Fixed tab skipping items in online player

This commit is contained in:
Nathan Dinsmore 2014-05-28 18:33:23 -04:00
parent e63fef2c44
commit bbbd5e5039
2 changed files with 6 additions and 2 deletions

View file

@ -67,9 +67,10 @@ public class ListCell extends Sprite {
tf.y = 1;
tf.addEventListener(Event.CHANGE, whenChanged);
tf.addEventListener(KeyboardEvent.KEY_DOWN, keyPress);
addChild(tf);
tf.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, stopKeyFocus);
tf.addEventListener(FocusEvent.FOCUS_IN, focusChange);
tf.addEventListener(FocusEvent.FOCUS_OUT, focusChange);
addChild(tf);
}
public function select():void {
@ -77,6 +78,10 @@ public class ListCell extends Sprite {
tf.setSelection(0, tf.text.length);
}
private function stopKeyFocus(e:FocusEvent):void {
e.preventDefault();
}
private function focusChange(e:FocusEvent):void {
var hasFocus:Boolean = (e.type == FocusEvent.FOCUS_IN);
frame.setColor(hasFocus ? focusedColor : normalColor);

View file

@ -551,7 +551,6 @@ public class ListWatcher extends Sprite {
for (var i:int = 0; i < visibleCells.length; i++) {
var cell:ListCell = visibleCells[i];
if (cell.tf == cellContents) {
e.preventDefault();
selectCell((firstVisibleIndex + i + direction + contents.length) % contents.length);
return;
}