Package | feathers.utils.keyboard |
Class | public class KeyToSelect |
Inheritance | KeyToSelect Object |
Product Version : | Feathers 3.0.0 |
isSelected
property of the target when a key is
pressed and released while the target has focus. The target will
dispatch Event.CHANGE
. Conveniently handles all
KeyboardEvent
listeners automatically.
In the following example, a custom component will be selected when a key is pressed and released:
public class CustomComponent extends FeathersControl implements IFocusDisplayObject { public function CustomComponent() { super(); this._keyToSelect = new KeyToSelect(this); this._keyToSelect.keyCode = Keyboard.SPACE; } private var _keyToSelect:KeyToSelect; // ...
Note: When combined with a KeyToTrigger
instance, the
KeyToSelect
instance should be created second because
Event.TRIGGERED
should be dispatched before
Event.CHANGE
.
See also
Property | Defined By | ||
---|---|---|---|
cancelKeyCode : uint
The key that will cancel the selection if the key is down. | KeyToSelect | ||
isEnabled : Boolean
May be set to false to disable selection temporarily
until set back to true. | KeyToSelect | ||
keyCode : uint
The key that will select the target, when pressed. | KeyToSelect | ||
keyLocation : uint
The location of the key that will select the target, when pressed. | KeyToSelect | ||
keyToDeselect : Boolean
May be set to true to allow the target to be deselected
when the key is pressed. | KeyToSelect | ||
target : IToggle
The target component that should be selected when a key is pressed. | KeyToSelect |
Method | Defined By | ||
---|---|---|---|
KeyToSelect(target:IToggle = null, keyCode:uint)
Constructor. | KeyToSelect |
cancelKeyCode | property |
cancelKeyCode:uint
The key that will cancel the selection if the key is down.
The default value is flash.ui.Keyboard.ESCAPE
.
public function get cancelKeyCode():uint
public function set cancelKeyCode(value:uint):void
isEnabled | property |
isEnabled:Boolean
May be set to false
to disable selection temporarily
until set back to true
.
public function get isEnabled():Boolean
public function set isEnabled(value:Boolean):void
keyCode | property |
keyCode:uint
The key that will select the target, when pressed.
The default value is flash.ui.Keyboard.SPACE
.
public function get keyCode():uint
public function set keyCode(value:uint):void
keyLocation | property |
keyLocation:uint
The location of the key that will select the target, when pressed.
If uint.MAX_VALUE
, then any key location is allowed.
The default value is uint.MAX_VALUE
.
public function get keyLocation():uint
public function set keyLocation(value:uint):void
See also
keyToDeselect | property |
keyToDeselect:Boolean
May be set to true
to allow the target to be deselected
when the key is pressed.
The default value is false
.
public function get keyToDeselect():Boolean
public function set keyToDeselect(value:Boolean):void
target | property |
target:IToggle
The target component that should be selected when a key is pressed.
public function get target():IToggle
public function set target(value:IToggle):void
KeyToSelect | () | Constructor |
public function KeyToSelect(target:IToggle = null, keyCode:uint)
Constructor.
Parameterstarget:IToggle (default = null )
| |
keyCode:uint (default = NaN )
|