Flash Lite 2.x and 3.0 ActionScript Language Reference

Selection

Object
    |
    +-Selection

public class Selection
extends Object

The Selection class lets you set and control the text field in which the insertion point is located (that is, the field that has focus). Selection-span indexes are zero-based (for example, the first position is 0, the second position is 1, and so on).

There is no constructor function for the Selection class, because there can be only one currently focused field at a time.

The Selection object is valid only when a device supports inline text entry. If a device does not support inline text entry, and instead relies on an FEP (front-end processor) to enter text, all calls to the Selection object are ignored.

Property summary

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

onSetFocus = function([oldfocus], [newfocus]) {}

Notified when the input focus changes.

Method summary

Modifiers

Signature

Description

static

addListener(listener:Object) : Void

Registers an object to receive keyboard focus change notifications.

static

getFocus() : String

Returns a string specifying the target path of the object that has focus.

static

removeListener(listener:Object) : Boolean

Removes an object previously registered with the Selection.addListener() method.

static

setFocus(newFocus:Object) : Boolean

Gives focus to the selectable (editable) text field, button, or movie clip, that the newFocus parameter specifies.

static

setSelection(beginIndex:Number, endIndex:Number) : Void

Sets the selection span of the currently focused text field.

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)