Package | dom.events |
Class | public class KeyEvent |
Inheritance | KeyEvent UIEvent Event Object |
Introduced in: | DOM 3 Events |
Note: This is from DOM 3 Events Working Draft 10 (April 2001) and has since been deprecated in Working Draft 21 (December 2007)
See also
Property | Defined By | ||
---|---|---|---|
DOM 2 Events bubbles : Boolean [read-only]
Used to indicate whether or not an event is a bubbling event. | Event | ||
DOM 2 Events cancelable : Boolean [read-only]
Indicates whether the event is cancelable or not. | Event | ||
DOM 2 Events currentTarget : EventTarget [read-only]
Identifies the current target for the event, as the event traverses the DOM. | Event | ||
DOM 3 Events defaulPrevented : Boolean [read-only]
Used to indicate whether Event.preventDefault() has been called for
this event. | Event | ||
DOM 2 Events detail : Number [read-only]
Specifies some detail information about the Event, depending
on the type of event. | UIEvent | ||
DOM 2 Events eventPhase : Number [read-only]
Used to indicate which phase of event flow is currently being accomplished. | Event | ||
Non-Standard explicitOriginalTarget : nsIDOMEventTarget [read-only]
The explicit original target of the event. | Event | ||
DOM 3 Events inputGenerated : Boolean
The inputGenerated attribute indicates whether the key event will normally cause visible output. | KeyEvent | ||
Non-Standard isChar : Boolean [read-only]
Returns a boolean indicating whether the event produced a key character or not. | UIEvent | ||
Non-Standard isTrusted : Boolean [read-only]
Determines if the event was from the user or script generated. | Event | ||
DOM 3 Events keyVal : Number
The value of keyVal holds the value of the Unicode character associated with the depressed key. | KeyEvent | ||
Non-Standard layerX : Number [read-only]
Returns the horizontal coordinate of the event relative to the current layer. | UIEvent | ||
Non-Standard layerY : Number [read-only]
Returns the vertical coordinate of the event relative to the current layer. | UIEvent | ||
DOM 3 Events namespaceURI : DOMString [read-only]
The namespace URI associated with this event at initialization time, or
null if it is unspecified. | Event | ||
DOM 3 Events numPad : Boolean
The numPad attribute indicates whether or not the key event was generated on the number pad section
of the keyboard. | KeyEvent | ||
Non-Standard originalTarget : * [read-only]
The original target of the event before any retargetings. | Event | ||
DOM 3 Events outputString : DOMString
outputString holds the value of the output generated by the key event. | KeyEvent | ||
Non-Standard pageX : Number [read-only]
Returns the horizontal coordinate of the event relative to whole document. | UIEvent | ||
Non-Standard pageY : Number [read-only]
Returns the vertical coordinate of the event relative to the whole document. | UIEvent | ||
DOM 2 Events target : EventTarget [read-only]
Used to indicate the event target. | Event | ||
DOM 2 Events timeStamp : DOMTimeStamp [read-only]
Used to specify the time at which the event was created in milliseconds
relative to 1970-01-01T00:00:00Z. | Event | ||
DOM 2 Events type : DOMString [read-only]
The local name of the event type. | Event | ||
DOM 2 Events view : AbstractView [read-only]
Returns the AbstractView object from which the event was generated. | UIEvent | ||
DOM 3 Events virtKeyVal : Number
When the key associated with a key event is not representable via a Unicode character virtKeyVale holds
the virtual key code associated with the depressed key. | KeyEvent | ||
Non-Standard which : DOMString [read-only]
Returns the numeric keyCode of the key pressed, or the character code (charCode) for
an alphanumeric key pressed. | UIEvent |
Method | Defined By | ||
---|---|---|---|
DOM 3 Events checkModifier(modifer:Number):Boolean
The CheckModifier method is used to check the status of a single modifier key associated with a KeyEvent. | KeyEvent | ||
Initializes attributes of an Event created through the
DocumentEvent.createEvent method. | Event | ||
DOM 3 Events initEventNS(namespaceURIArg:DOMString, typeArg:DOMString, canBubbleArg:Boolean, cancelableArg:Boolean):void
Initializes attributes of an Event object. | Event | ||
DOM 3 Events initKeyEvent(typeArg:DOMString, canBubbleArg:Boolean, cancelableArg:Boolean, viewArg:AbstractView, detailArg:Number, outputStringArg:DOMString, keyValArg:Number, virtKeyValArg:Number, inputGeneratedArg:Boolean, numPadArg:Boolean):void
The initKeyEvent method is used to initialize the value of a MouseEvent created through
the DocumentEvent interface. | KeyEvent | ||
DOM 3 Events initModifier(modifier:Number, value:Boolean):void
The initModifier method is used to initialize the values of any modifiers associated with a KeyEvent
created through the DocumentEvent interface. | KeyEvent | ||
DOM 2 Events initUIEvent(typeArg:DOMString, canBubbleArg:Boolean, cancelableArg:Boolean, viewArg:AbstractView, detailArg:Number):void
Initializes attributes of an UIEvent object. | UIEvent | ||
DOM 3 Events initUIEventNS(namespaceURIArg:DOMString, typeArg:DOMString, canBubbleArg:Boolean, cancelableArg:Boolean, viewArg:AbstractView, detailArg:Number):void
Initializes attributes of an UIEvent object. | UIEvent | ||
Obsolete preventBubble():void
Prevents the event from bubbling. | Event | ||
Obsolete preventCapture():void
This method is deprecated in favor of standard stopPropagation and is removed in Gecko 1.9. | Event | ||
DOM 2 Events preventDefault():void
Cancels the event if it is cancelable, without stopping further propagation of the event. | Event | ||
DOM 3 Events stopImmediatePropogation():void
Prevents other event listeners from being triggered and, unlike
Event.stopPropagation() its effect is immediate . | Event | ||
DOM 2 Events stopPropogation():void
Prevents other event listeners from being triggered but its effect is
deferred until all event listeners attached on the Event.currentTarget
have been triggered . | Event |
Constant | Defined By | ||
---|---|---|---|
HTML 4.0 abort : String = abort [static]
Loading of a resource has been aborted. | UIEvent | ||
DOM 2 Events AT_TARGET : Number = 2 [static]
The current event is in the target phase, i.e. | Event | ||
DOM 2 Events blur : String = blur [static]
An event target loses focus. | UIEvent | ||
DOM 2 Events BUBBLING_PHASE : Number = 3 [static]
The current event phase is the bubbling phase. | Event | ||
DOM 2 Events CAPTURING_PHASE : Number = 1 [static]
The current event phase is the capture phase. | Event | ||
HTML 4.0 change : String = change [static]
A control loses the input focus and its value has been modified since gaining focus. | UIEvent | ||
DOM 2 Events DOMActivate : String = DOMActivate [static]
Refer to Activation requests and behavior. | UIEvent | ||
DOM 2 Events DOMFocusIn : String = DOMFocusIn [static]
An event target receives focus. | UIEvent | ||
DOM 2 Events DOMFocusOut : String = DOMFocusOut [static]
An event target loses focus. | UIEvent | ||
DOM_VK_CAPS_LOCK : Number = 9 [static] | KeyEvent | ||
DOM_VK_DELETE : Number = 10 [static] | KeyEvent | ||
DOM_VK_DOWN : Number = 23 [static] | KeyEvent | ||
DOM_VK_END : Number = 11 [static] | KeyEvent | ||
DOM_VK_ENTER : Number = 12 [static] | KeyEvent | ||
DOM_VK_ESCAPE : Number = 13 [static] | KeyEvent | ||
DOM_VK_F1 : Number = 26 [static]
Constant for the F1 function key. | KeyEvent | ||
DOM_VK_F10 : Number = 35 [static]
Constant for the F10 function key. | KeyEvent | ||
DOM_VK_F11 : Number = 36 [static]
Constant for the F11 function key. | KeyEvent | ||
DOM_VK_F12 : Number = 37 [static]
Constant for the F12 function key. | KeyEvent | ||
DOM_VK_F13 : Number = 38 [static]
Constant for the F13 function key. | KeyEvent | ||
DOM_VK_F14 : Number = 39 [static]
Constant for the F14 function key. | KeyEvent | ||
DOM_VK_F15 : Number = 40 [static]
Constant for the F15 function key. | KeyEvent | ||
DOM_VK_F16 : Number = 41 [static]
Constant for the F16 function key. | KeyEvent | ||
DOM_VK_F17 : Number = 42 [static]
Constant for the F17 function key. | KeyEvent | ||
DOM_VK_F18 : Number = 43 [static]
Constant for the F18 function key. | KeyEvent | ||
DOM_VK_F19 : Number = 44 [static]
Constant for the F19 function key. | KeyEvent | ||
DOM_VK_F2 : Number = 27 [static]
Constant for the F2 function key. | KeyEvent | ||
DOM_VK_F20 : Number = 45 [static]
Constant for the F20 function key. | KeyEvent | ||
DOM_VK_F21 : Number = 46 [static]
Constant for the F21 function key. | KeyEvent | ||
DOM_VK_F22 : Number = 47 [static]
Constant for the F22 function key. | KeyEvent | ||
DOM_VK_F23 : Number = 48 [static]
Constant for the F23 function key. | KeyEvent | ||
DOM_VK_F24 : Number = 49 [static]
Constant for the F24 function key. | KeyEvent | ||
DOM_VK_F3 : Number = 28 [static]
Constant for the F3 function key. | KeyEvent | ||
DOM_VK_F4 : Number = 29 [static]
Constant for the F4 function key. | KeyEvent | ||
DOM_VK_F5 : Number = 30 [static]
Constant for the F5 function key. | KeyEvent | ||
DOM_VK_F6 : Number = 31 [static]
Constant for the F6 function key. | KeyEvent | ||
DOM_VK_F7 : Number = 32 [static]
Constant for the F7 function key. | KeyEvent | ||
DOM_VK_F8 : Number = 33 [static]
Constant for the F8 function key. | KeyEvent | ||
DOM_VK_F9 : Number = 34 [static]
Constant for the F9 function key. | KeyEvent | ||
DOM_VK_HOME : Number = 14 [static] | KeyEvent | ||
DOM_VK_INSERT : Number = 15 [static] | KeyEvent | ||
DOM_VK_LEFT : Number = 20 [static] | KeyEvent | ||
DOM_VK_LEFT_ALT : Number = 2 [static]
This key is a modifier key
| KeyEvent | ||
DOM_VK_LEFT_CONTROL : Number = 3 [static]
This key is a modifier key
| KeyEvent | ||
DOM_VK_LEFT_META : Number = 7 [static]
This key is a modifier key
| KeyEvent | ||
DOM_VK_LEFT_SHIFT : Number = 5 [static]
This key is a modifier key
| KeyEvent | ||
DOM_VK_NUM_LOCK : Number = 16 [static] | KeyEvent | ||
DOM_VK_PAGE_DOWN : Number = 24 [static] | KeyEvent | ||
DOM_VK_PAGE_UP : Number = 25 [static] | KeyEvent | ||
DOM_VK_PAUSE : Number = 17 [static] | KeyEvent | ||
DOM_VK_PRINTSCREEN : Number = 18 [static] | KeyEvent | ||
DOM_VK_RIGHT : Number = 21 [static] | KeyEvent | ||
DOM_VK_RIGHT_ALT : Number = 1 [static]
This key is a modifier key
| KeyEvent | ||
DOM_VK_RIGHT_CONTROL : Number = 4 [static]
This key is a modifier key
| KeyEvent | ||
DOM_VK_RIGHT_META : Number = 8 [static]
This key is a modifier key
| KeyEvent | ||
DOM_VK_RIGHT_SHIFT : Number = 6 [static]
This key is a modifier key
| KeyEvent | ||
DOM_VK_SCROLL_LOCK : Number = 19 [static] | KeyEvent | ||
DOM_VK_UNDEFINED : Number = 0 [static]
Used for key events which do not have a virtual key code available. | KeyEvent | ||
DOM_VK_UP : Number = 22 [static] | KeyEvent | ||
HTML 4.0 error : String = error [static]
A resource failed to load, or has been loaded but cannot be interpreted according to its semantics
such as an invalid image, a script execution error, or non-well-formed XML. | UIEvent | ||
DOM 2 Events focus : String = focus [static]
An event target receives focus. | UIEvent | ||
HTML 4.0 load : String = load [static]
The DOM Implementation finishes loading the resource (such as the document) and any dependent resources
(such as images, style sheets, or scripts). | UIEvent | ||
HTML 4.0 reset : String = reset [static]
A form, such as a [HTML 4.01] or [XHTML 1.0] form, is reset. | UIEvent | ||
DOM 2 Events resize : String = resize [static]
A document view or an element has been resized. | UIEvent | ||
DOM 2 Events scroll : String = scroll [static]
A document view or an element has been scrolled. | UIEvent | ||
HTML 4.0 select : String = select [static]
A user selects some text. | UIEvent | ||
HTML 4.0 submit : String = submit [static]
A form, such as a [HTML 4.01] or [XHTML 1.0] form, is submitted. | UIEvent | ||
HTML 4.0 unload : String = unload [static]
The DOM implementation removes from the environment the resource (such as the document) or any dependent
resources (such as images, style sheets, scripts). | UIEvent |
DOM 3 Events inputGenerated | property |
inputGenerated:Boolean
Introduced in: | DOM 3 Events |
The inputGenerated attribute indicates whether the key event will normally cause visible output. If the key event does not generate any visible output, such as the use of a function key or the combination of certain modifier keys used in conjunction with another key, then the value will be false. If visible output is normally generated by the key event then the value will be true.
The value of inputGenerated does not guarantee the creation of a character. If a key event causing visible output is cancelable it may be prevented from causing output. This attribute is intended primarily to differentiate between keys events which may or may not produce visible output depending on the system state.
public function get inputGenerated():Boolean
public function set inputGenerated(value:Boolean):void
See also
DOM 3 Events keyVal | property |
keyVal:Number
Introduced in: | DOM 3 Events |
The value of keyVal holds the value of the Unicode character associated with the depressed key. If the key has no Unicode representation or no Unicode character is available the value is 0.
public function get keyVal():Number
public function set keyVal(value:Number):void
See also
DOM 3 Events numPad | property |
numPad:Boolean
Introduced in: | DOM 3 Events |
The numPad attribute indicates whether or not the key event was generated on the number pad section of the keyboard. If the number pad was used to generate the key event the value is true, otherwise the value is false.
public function get numPad():Boolean
public function set numPad(value:Boolean):void
See also
DOM 3 Events outputString | property |
outputString:DOMString
Introduced in: | DOM 3 Events |
outputString holds the value of the output generated by the key event. This may be a single Unicode character or it may be a string. It may also be null in the case where no output was generated by the key event.
public function get outputString():DOMString
public function set outputString(value:DOMString):void
See also
DOM 3 Events virtKeyVal | property |
virtKeyVal:Number
Introduced in: | DOM 3 Events |
When the key associated with a key event is not representable via a Unicode character virtKeyVale holds the virtual key code associated with the depressed key. If the key has a Unicode representation or no virtual code is available the value is DOM_VK_UNDEFINED.
public function get virtKeyVal():Number
public function set virtKeyVal(value:Number):void
See also
DOM 3 Events checkModifier | () | method |
public function checkModifier(modifer:Number):Boolean
Introduced in: | DOM 3 Events |
The CheckModifier method is used to check the status of a single modifier key associated with a KeyEvent. The identifier of the modifier in question is passed into the CheckModifier function. If the modifier is triggered it will return true. If not, it will return false.
The list of keys below represents the allowable modifier paramaters for this method.
Parameters
modifer:Number — The modifier which the user wishes to query.
|
Boolean — The status of the modifier represented as a boolean.
|
See also
DOM 3 Events initKeyEvent | () | method |
public function initKeyEvent(typeArg:DOMString, canBubbleArg:Boolean, cancelableArg:Boolean, viewArg:AbstractView, detailArg:Number, outputStringArg:DOMString, keyValArg:Number, virtKeyValArg:Number, inputGeneratedArg:Boolean, numPadArg:Boolean):void
Introduced in: | DOM 3 Events |
The initKeyEvent method is used to initialize the value of a MouseEvent created through the DocumentEvent interface. This method may only be called before the KeyEvent has been dispatched via the dispatchEvent method, though it may be called multiple times during that phase if necessary. If called multiple times, the final invocation takes precedence. This method has no effect if called after the event has been dispatched.
Parameters
typeArg:DOMString — Specifies the event type.
| |
canBubbleArg:Boolean — Specifies whether or not the event can bubble.
| |
cancelableArg:Boolean — Specifies whether or not the event's default action can be prevent.
| |
viewArg:AbstractView — Specifies the KeyEvent's AbstractView.
| |
detailArg:Number — Specifies the number of repeated keypresses, if available.
| |
outputStringArg:DOMString — Specifies the KeyEvent's outputString attribute
| |
keyValArg:Number — Specifies the KeyEvent's keyValattribute
| |
virtKeyValArg:Number — Specifies the KeyEvent's virtKeyValattribute
| |
inputGeneratedArg:Boolean — Specifies the KeyEvent's inputGeneratedattribute
| |
numPadArg:Boolean — Specifies the KeyEvent's numPadattribute
|
See also
DOM 3 Events initModifier | () | method |
public function initModifier(modifier:Number, value:Boolean):void
Introduced in: | DOM 3 Events |
The initModifier method is used to initialize the values of any modifiers associated with a KeyEvent created through the DocumentEvent interface. This method may only be called before the KeyEvent has been dispatched via the dispatchEvent method, though it may be called multiple times during that phase if necessary. If called multiple times with the same modifier property the final invocation takes precedence. Unless explicitly give a value of true, all modifiers have a value of false. This method has no effect if called after the event has been dispatched.
The list of keys below represents the allowable modifier paramaters for this method.
Parameters
modifier:Number — The modifier which the user wishes to initialize
| |
value:Boolean — The new value of the modifier.
|
See also
DOM_VK_CAPS_LOCK | Constant |
public static const DOM_VK_CAPS_LOCK:Number = 9
DOM_VK_DELETE | Constant |
public static const DOM_VK_DELETE:Number = 10
DOM_VK_DOWN | Constant |
public static const DOM_VK_DOWN:Number = 23
DOM_VK_END | Constant |
public static const DOM_VK_END:Number = 11
DOM_VK_ENTER | Constant |
public static const DOM_VK_ENTER:Number = 12
DOM_VK_ESCAPE | Constant |
public static const DOM_VK_ESCAPE:Number = 13
DOM_VK_F1 | Constant |
public static const DOM_VK_F1:Number = 26
Constant for the F1 function key.
DOM_VK_F10 | Constant |
public static const DOM_VK_F10:Number = 35
Constant for the F10 function key.
DOM_VK_F11 | Constant |
public static const DOM_VK_F11:Number = 36
Constant for the F11 function key.
DOM_VK_F12 | Constant |
public static const DOM_VK_F12:Number = 37
Constant for the F12 function key.
DOM_VK_F13 | Constant |
public static const DOM_VK_F13:Number = 38
Constant for the F13 function key.
DOM_VK_F14 | Constant |
public static const DOM_VK_F14:Number = 39
Constant for the F14 function key.
DOM_VK_F15 | Constant |
public static const DOM_VK_F15:Number = 40
Constant for the F15 function key.
DOM_VK_F16 | Constant |
public static const DOM_VK_F16:Number = 41
Constant for the F16 function key.
DOM_VK_F17 | Constant |
public static const DOM_VK_F17:Number = 42
Constant for the F17 function key.
DOM_VK_F18 | Constant |
public static const DOM_VK_F18:Number = 43
Constant for the F18 function key.
DOM_VK_F19 | Constant |
public static const DOM_VK_F19:Number = 44
Constant for the F19 function key.
DOM_VK_F2 | Constant |
public static const DOM_VK_F2:Number = 27
Constant for the F2 function key.
DOM_VK_F20 | Constant |
public static const DOM_VK_F20:Number = 45
Constant for the F20 function key.
DOM_VK_F21 | Constant |
public static const DOM_VK_F21:Number = 46
Constant for the F21 function key.
DOM_VK_F22 | Constant |
public static const DOM_VK_F22:Number = 47
Constant for the F22 function key.
DOM_VK_F23 | Constant |
public static const DOM_VK_F23:Number = 48
Constant for the F23 function key.
DOM_VK_F24 | Constant |
public static const DOM_VK_F24:Number = 49
Constant for the F24 function key.
DOM_VK_F3 | Constant |
public static const DOM_VK_F3:Number = 28
Constant for the F3 function key.
DOM_VK_F4 | Constant |
public static const DOM_VK_F4:Number = 29
Constant for the F4 function key.
DOM_VK_F5 | Constant |
public static const DOM_VK_F5:Number = 30
Constant for the F5 function key.
DOM_VK_F6 | Constant |
public static const DOM_VK_F6:Number = 31
Constant for the F6 function key.
DOM_VK_F7 | Constant |
public static const DOM_VK_F7:Number = 32
Constant for the F7 function key.
DOM_VK_F8 | Constant |
public static const DOM_VK_F8:Number = 33
Constant for the F8 function key.
DOM_VK_F9 | Constant |
public static const DOM_VK_F9:Number = 34
Constant for the F9 function key.
DOM_VK_HOME | Constant |
public static const DOM_VK_HOME:Number = 14
DOM_VK_INSERT | Constant |
public static const DOM_VK_INSERT:Number = 15
DOM_VK_LEFT | Constant |
public static const DOM_VK_LEFT:Number = 20
DOM_VK_LEFT_ALT | Constant |
public static const DOM_VK_LEFT_ALT:Number = 2
This key is a modifier key
DOM_VK_LEFT_CONTROL | Constant |
public static const DOM_VK_LEFT_CONTROL:Number = 3
This key is a modifier key
DOM_VK_LEFT_META | Constant |
public static const DOM_VK_LEFT_META:Number = 7
This key is a modifier key
DOM_VK_LEFT_SHIFT | Constant |
public static const DOM_VK_LEFT_SHIFT:Number = 5
This key is a modifier key
DOM_VK_NUM_LOCK | Constant |
public static const DOM_VK_NUM_LOCK:Number = 16
DOM_VK_PAGE_DOWN | Constant |
public static const DOM_VK_PAGE_DOWN:Number = 24
DOM_VK_PAGE_UP | Constant |
public static const DOM_VK_PAGE_UP:Number = 25
DOM_VK_PAUSE | Constant |
public static const DOM_VK_PAUSE:Number = 17
DOM_VK_PRINTSCREEN | Constant |
public static const DOM_VK_PRINTSCREEN:Number = 18
DOM_VK_RIGHT | Constant |
public static const DOM_VK_RIGHT:Number = 21
DOM_VK_RIGHT_ALT | Constant |
public static const DOM_VK_RIGHT_ALT:Number = 1
This key is a modifier key
DOM_VK_RIGHT_CONTROL | Constant |
public static const DOM_VK_RIGHT_CONTROL:Number = 4
This key is a modifier key
DOM_VK_RIGHT_META | Constant |
public static const DOM_VK_RIGHT_META:Number = 8
This key is a modifier key
DOM_VK_RIGHT_SHIFT | Constant |
public static const DOM_VK_RIGHT_SHIFT:Number = 6
This key is a modifier key
DOM_VK_SCROLL_LOCK | Constant |
public static const DOM_VK_SCROLL_LOCK:Number = 19
DOM_VK_UNDEFINED | Constant |
public static const DOM_VK_UNDEFINED:Number = 0
Used for key events which do not have a virtual key code available.
DOM_VK_UP | Constant |
public static const DOM_VK_UP:Number = 22