Package | cc.cote.feathers.softkeyboard |
Class | public class Key |
Inheritance | Key ![]() |
Key
class creates individual soft-keyboard keys to use in keyboard
Layouts
and key collections.
Both the key and its label have several tokens in their nameList
property to
facilitate skinning of individual keys. First, they have a charCodeXX
token
where XX
is the character code. Second, their label's text is also a token in
their nameList
. Finally, when appropriate, they will have the
hasVariant
token in their nameList
to identify keys with
variants.
See also
Property | Defined By | ||
---|---|---|---|
character : String [read-only] The single character associated to the key. | Key | ||
charCode : uint [read-only] The character code of the key. | Key | ||
hasVariants : Boolean [read-only] Indicates whether the key is a variant key (true) or a primary key (false) | Key | ||
hasVariantsKeyDownSkin : DisplayObject The skin to use for keys that have variants, in the 'hover' state. | Key | ||
hasVariantsKeyHoverSkin : DisplayObject The skin to use for keys that have variants, in the 'hover' state. | Key | ||
hasVariantsKeyUpSkin : DisplayObject The skin to use for keys that have variants, the 'up' state. | Key | ||
icon : DisplayObject
The key's icon (if any). | Key | ||
isPrintable : Boolean [read-only]
Indicates if the key is associated with a printable character. | Key | ||
isSelected : Boolean
Indicates if the key is 'selected'. | Key | ||
isSpecial : Boolean [read-only]
Indicates if the key is 'special'. | Key | ||
isVariant : Boolean Indicates whether the key is a variant key (true) or a primary key (false) | Key | ||
isVisible : Boolean [read-only]
Indicates if the key is associated with a visible character. | Key | ||
keyVariantsDelay : uint = 150
The number of milliseconds to wait after a key has been pressed before displaying the
variants (if any are available). | Key | ||
label : Label The Label object used by this key | Key | ||
regularKeyDownSkin : DisplayObject The skin to use for regular keys in the 'down' state. | Key | ||
regularKeyHoverSkin : DisplayObject The skin to use for regular keys in the 'hover' state. | Key | ||
regularKeyUpSkin : DisplayObject The skin to use for regular keys in the 'up' state. | Key | ||
relativeHeight : Number [read-only] Relative height of the key expressed as a ratio of the default key height. | Key | ||
relativeWidth : Number [read-only] Relative width of the key expressed as a ratio of the default key width. | Key | ||
selectedIcon : DisplayObject The key's icon while in 'selected' state. | Key | ||
specialKeyDownSkin : DisplayObject The skin to use for special keys in the 'down' state. | Key | ||
specialKeyHoverSkin : DisplayObject The skin to use for special keys in the 'hover' state. | Key | ||
specialKeyUpSkin : DisplayObject The skin to use for special keys in the 'up' state. | Key | ||
switchToLayoutClass : Class
A layout (specified by its class) to switch to when the key is released. | Key | ||
type : String [read-only] The type of key (character, navigation, modifier, etc.). | Key | ||
variants : Vector.<Key> [read-only] Vector of keys accessible by pressing and holding the key. | Key | ||
variantsContainer : Sprite [read-only] | Key |
Method | Defined By | ||
---|---|---|---|
Key(charCode:int, variants:Vector.<Key> = null, type:String = characterKey, label:String = null, relativeWidth:Number = 1, relativeHeight:Number = 1, switchToLayoutClass:Class = null)
Creates a new instance of the Key object. | Key | ||
changeCase(keyCase:String):void
Changes the case of the character, label and variants of the key. | Key | ||
changeState(state:String):void
Changes the key's current state (which in turn will likely change its skin). | Key | ||
dispose():void [override] | Key | ||
lowercase():void
Lowercases the character, label and variants of the key. | Key | ||
uppercase():void
Uppercases the character, label and variants of the key. | Key |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when a key is pressed down. | Key | |||
Dispatched when a the key is released. | Key | |||
Dispatched when the variants for a key should be displayed. | Key |
Constant | Defined By | ||
---|---|---|---|
AVAILABLE_STATES : Array Array of valid key states | Key | ||
CHARACTER_KEY : String = characterKey [static] An identifier for regular alphanumeric character keys. | Key | ||
DOWN_STATE : String = Down [static] Constant associated with the text representation of the key down state | Key | ||
EDITING_KEY : String = editingKey [static] An identifier for editing keys. | Key | ||
FUNCTION_KEY : String = functionKey [static] An identifier for function keys. | Key | ||
HOVER_STATE : String = Hover [static] Constant associated with the text representation of the key hover state | Key | ||
LOCK_KEY : String = lockKey [static] An identifier for lock keys. | Key | ||
MODIFIER_KEY : String = modifierKey [static] An identifier for modifier keys. | Key | ||
NAVIGATION_KEY : String = navigationKey [static] An identifier for navigation keys. | Key | ||
NUMERIC_KEYPAD_KEY : String = numericKeypadKey [static] An identifier for numeric keypad keys. | Key | ||
SOFTKEYBOARD_KEY_LABEL : String = softkeyboard-key-label [static]
Constant associated with the text representation of the label's name as used in the
label's nameList property (for theming purposes). | Key | ||
SYSTEM_KEY : String = systemKey [static] An identifier for system keys. | Key | ||
UP_STATE : String = Up [static] Constant associated with the text representation of the key up state | Key |
character | property |
character:String
[read-only] The single character associated to the key.
public function get character():String
charCode | property |
charCode:uint
[read-only] The character code of the key.
public function get charCode():uint
hasVariants | property |
hasVariants:Boolean
[read-only] Indicates whether the key is a variant key (true) or a primary key (false)
public function get hasVariants():Boolean
hasVariantsKeyDownSkin | property |
public var hasVariantsKeyDownSkin:DisplayObject
The skin to use for keys that have variants, in the 'hover' state.
hasVariantsKeyHoverSkin | property |
public var hasVariantsKeyHoverSkin:DisplayObject
The skin to use for keys that have variants, in the 'hover' state.
hasVariantsKeyUpSkin | property |
public var hasVariantsKeyUpSkin:DisplayObject
The skin to use for keys that have variants, the 'up' state.
icon | property |
public var icon:DisplayObject
The key's icon (if any). Icons are usually reserved for 'special' keys such as: CAPS_LOCK, ENTER, TAB, etc.
isPrintable | property |
isPrintable:Boolean
[read-only] Indicates if the key is associated with a printable character. Printable characters include all letters, numbers and symbols as well as the ENTER, SPACE and TAB keys.
public function get isPrintable():Boolean
isSelected | property |
isSelected:Boolean
Indicates if the key is 'selected'. The selected state is currently only used for the
CAPS_LOCK
key. When the CAPS_LOCK
is engaged, a different icon
is shown.
public function get isSelected():Boolean
public function set isSelected(value:Boolean):void
isSpecial | property |
isSpecial:Boolean
[read-only] Indicates if the key is 'special'. A 'special' key is any key that is not a regular alpha-numeric character or the space character key.
public function get isSpecial():Boolean
isVariant | property |
isVariant:Boolean
Indicates whether the key is a variant key (true) or a primary key (false)
public function get isVariant():Boolean
public function set isVariant(value:Boolean):void
isVisible | property |
isVisible:Boolean
[read-only] Indicates if the key is associated with a visible character. Visible characters include all letters, numbers and symbols.
public function get isVisible():Boolean
keyVariantsDelay | property |
public var keyVariantsDelay:uint = 150
The number of milliseconds to wait after a key has been pressed before displaying the variants (if any are available).
label | property |
label:Label
The Label object used by this key
public function get label():Label
public function set label(value:Label):void
regularKeyDownSkin | property |
public var regularKeyDownSkin:DisplayObject
The skin to use for regular keys in the 'down' state.
regularKeyHoverSkin | property |
public var regularKeyHoverSkin:DisplayObject
The skin to use for regular keys in the 'hover' state.
regularKeyUpSkin | property |
public var regularKeyUpSkin:DisplayObject
The skin to use for regular keys in the 'up' state.
relativeHeight | property |
relativeHeight:Number
[read-only] Relative height of the key expressed as a ratio of the default key height.
public function get relativeHeight():Number
relativeWidth | property |
relativeWidth:Number
[read-only] Relative width of the key expressed as a ratio of the default key width.
public function get relativeWidth():Number
selectedIcon | property |
public var selectedIcon:DisplayObject
The key's icon while in 'selected' state.
specialKeyDownSkin | property |
public var specialKeyDownSkin:DisplayObject
The skin to use for special keys in the 'down' state.
specialKeyHoverSkin | property |
public var specialKeyHoverSkin:DisplayObject
The skin to use for special keys in the 'hover' state.
specialKeyUpSkin | property |
public var specialKeyUpSkin:DisplayObject
The skin to use for special keys in the 'up' state.
switchToLayoutClass | property |
public var switchToLayoutClass:Class
A layout (specified by its class) to switch to when the key is released. It is mostly
used with the SWITCH_LAYOUT
key but also works with other keys.
type | property |
type:String
[read-only] The type of key (character, navigation, modifier, etc.).
public function get type():String
variants | property |
variants:Vector.<Key>
[read-only] Vector of keys accessible by pressing and holding the key.
public function get variants():Vector.<Key>
variantsContainer | property |
variantsContainer:Sprite
[read-only] public function get variantsContainer():Sprite
Key | () | Constructor |
public function Key(charCode:int, variants:Vector.<Key> = null, type:String = characterKey, label:String = null, relativeWidth:Number = 1, relativeHeight:Number = 1, switchToLayoutClass:Class = null)
Creates a new instance of the Key object.
ParameterscharCode:int — Character-code to assign to the key.
| |
variants:Vector.<Key> (default = null ) — A vector of Keys to use as variations of the main key. The
key variants are displayed when the user keeps its finger for a little while on a key.
For example, variants of the 'e' key could be 'é', 'è', 'ë', etc.
| |
type:String (default = characterKey ) — The type of key (CHARACTER_KEY, SYSTEM_KEY, etc.).
| |
label:String (default = null ) — The textual label to display on the key.
| |
relativeWidth:Number (default = 1 ) — A ratio of the normal key width used to relatively enlarge or make a
key smaller. For example, if you wanted a key to be twice as wide as usual, you would
specify a relative width of 2.
| |
relativeHeight:Number (default = 1 ) — A ratio of the normal key height used to enlarge or make a key
smaller. For example, if you wanted a key to be twice as high as usual, you would specify
a relative height of 2.
| |
switchToLayoutClass:Class (default = null ) — A layout (specified by its class) to switch to when the key is
released. Only works with SoftKeyboard.SWITCH_LAYOUT keys.
|
changeCase | () | method |
public function changeCase(keyCase:String):void
Changes the case of the character, label and variants of the key. This only affects keys
whose isVisible
property return true
.
Parameters
keyCase:String — Desired case: TypographicCase.UPPERCASE or
TypographicCase.LOWERCASE .
|
changeState | () | method |
public function changeState(state:String):void
Changes the key's current state (which in turn will likely change its skin).
Parameters
state:String — The state to change to. Allowed states are defined in the
AVAILABLE_STATES constant array.
|
dispose | () | method |
override public function dispose():void
lowercase | () | method |
public function lowercase():void
Lowercases the character, label and variants of the key. This only affects keys whose
isVisible
property return true
.
uppercase | () | method |
public function uppercase():void
Uppercases the character, label and variants of the key. This only affects keys whose
isVisible
property return true
.
cc.cote.feathers.softkeyboard.KeyEvent.keyDown | Event |
cc.cote.feathers.softkeyboard.KeyEvent
cc.cote.feathers.softkeyboard.KeyEvent.KEY_DOWN
Dispatched when a key is pressed down.
TheKEY_DOWN
constant defines the value of the type
property of
a keyDown
event object.
cc.cote.feathers.softkeyboard.KeyEvent.keyUp | Event |
cc.cote.feathers.softkeyboard.KeyEvent
cc.cote.feathers.softkeyboard.KeyEvent.KEY_UP
Dispatched when a the key is released. The release position must be above the key that was
initially pressed down otherwise the event is not fired. This allows the user to cancel the
keyUp
event.
KEY_UP
constant defines the value of the type
property of a
keyUp
event object.
cc.cote.feathers.softkeyboard.KeyEvent.showVariants | Event |
cc.cote.feathers.softkeyboard.KeyEvent
cc.cote.feathers.softkeyboard.KeyEvent.SHOW_VARIANTS
Dispatched when the variants for a key should be displayed.
TheSHOW_VARIANTS
constant defines the value of the type
property of a showVariants
event object.
AVAILABLE_STATES | Constant |
public const AVAILABLE_STATES:Array
Array of valid key states
CHARACTER_KEY | Constant |
public static const CHARACTER_KEY:String = characterKey
An identifier for regular alphanumeric character keys.
DOWN_STATE | Constant |
public static const DOWN_STATE:String = Down
Constant associated with the text representation of the key down state
EDITING_KEY | Constant |
public static const EDITING_KEY:String = editingKey
An identifier for editing keys.
FUNCTION_KEY | Constant |
public static const FUNCTION_KEY:String = functionKey
An identifier for function keys.
HOVER_STATE | Constant |
public static const HOVER_STATE:String = Hover
Constant associated with the text representation of the key hover state
LOCK_KEY | Constant |
public static const LOCK_KEY:String = lockKey
An identifier for lock keys.
MODIFIER_KEY | Constant |
public static const MODIFIER_KEY:String = modifierKey
An identifier for modifier keys.
NAVIGATION_KEY | Constant |
public static const NAVIGATION_KEY:String = navigationKey
An identifier for navigation keys.
NUMERIC_KEYPAD_KEY | Constant |
public static const NUMERIC_KEYPAD_KEY:String = numericKeypadKey
An identifier for numeric keypad keys.
SOFTKEYBOARD_KEY_LABEL | Constant |
public static const SOFTKEYBOARD_KEY_LABEL:String = softkeyboard-key-label
Constant associated with the text representation of the label's name as used in the label's nameList property (for theming purposes).
SYSTEM_KEY | Constant |
public static const SYSTEM_KEY:String = systemKey
An identifier for system keys.
UP_STATE | Constant |
public static const UP_STATE:String = Up
Constant associated with the text representation of the key up state