Key


Object
    |
    +-Key

public class Key
extends Object

The Key class is a top-level class whose methods and properties you can use without a constructor. Use the methods of the Key class to build an interface that can be controlled by a user with a standard keyboard. The properties of the Key class are constants representing the keys most commonly used to control applications, such as Arrow keys, Page Up, and Page Down.

A Flash application can only monitor keyboard events that occur within its focus. A Flash application cannot detect keyboard events in another application.

Availability: ActionScript 1.0; Flash Player 6

Property summary

Modifiers

Property

Description

static

BACKSPACE:Number

The key code value for the Backspace key (8).

static

CAPSLOCK:Number

The key code value for the Caps Lock key (20).

static

CONTROL:Number

The key code value for the Control key (17).

static

DELETEKEY:Number

The key code value for the Delete key (46).

static

DOWN:Number

The key code value for the Down Arrow key (40).

static

END:Number

The key code value for the End key (35).

static

ENTER:Number

The key code value for the Enter key (13).

static

ESCAPE:Number

The key code value for the Escape key (27).

static

HOME:Number

The key code value for the Home key (36).

static

INSERT:Number

The key code value for the Insert key (45).

static

LEFT:Number

The key code value for the Left Arrow key (37).

static

_listeners:Array [read-only]

A list of references to all listener objects that are registered with the Key object.

static

PGDN:Number

The key code value for the Page Down key (34).

static

PGUP:Number

The key code value for the Page Up key (33).

static

RIGHT:Number

The key code value for the Right Arrow key (39).

static

SHIFT:Number

The key code value for the Shift key (16).

static

SPACE:Number

The key code value for the Spacebar (32).

static

TAB:Number

The key code value for the Tab key (9).

static

UP:Number

The key code value for the Up Arrow key (38).

Properties inherited from class Object

constructor (Object.constructor property), __proto__ (Object.__proto__ property), prototype (Object.prototype property), __resolve (Object.__resolve property)


Event summary

Event

Description

onKeyDown = function() {}

Notified when a key is pressed.

onKeyUp = function() {}

Notified when a key is released.

Method summary

Modifiers

Signature

Description

static

addListener(listener:Object) : Void

Registers an object to receive onKeyDown and onKeyUp notification.

static

getAscii() : Number

Returns the ASCII code of the last key pressed or released.

static

getCode() : Number

Returns the key code value of the last key pressed.

static

isAccessible() : Boolean

Returns a Boolean value indicating, depending on security restrictions, whether the last key pressed may be accessed by other SWF files.

static

isDown(code:Number) : Boolean

Returns true if the key specified in keycode is pressed; false otherwise.

static

isToggled(code:Number) : Boolean

Returns true if the Caps Lock or Num Lock key is activated (toggled to an active state); false otherwise.

static

removeListener(listener:Object) : Boolean

Removes an object previously registered with Key.addListener().

Methods inherited from class Object

addProperty (Object.addProperty method), hasOwnProperty (Object.hasOwnProperty method), isPropertyEnumerable (Object.isPropertyEnumerable method), isPrototypeOf (Object.isPrototypeOf method), registerClass (Object.registerClass method), toString (Object.toString method), unwatch (Object.unwatch method), valueOf (Object.valueOf method), watch (Object.watch method)



Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00001748.html