03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Modifiers Signature Description<br />

static setFocus(newFocus:Ob<br />

ject) : Boolean<br />

static setSelection(beginIn<br />

dex:Number,<br />

endIndex:Number) :<br />

Void<br />

Methods inherited from class Object<br />

addListener (Selection.addListener method)<br />

public static addListener(listener:Object) : Void<br />

Registers an object to receive keyboard focus change notifications. When the focus changes<br />

(for example, whenever the Selection.setFocus() method is invoked), all listening objects<br />

registered with addListener() have their onSetFocus() method invoked. Multiple objects<br />

can listen for focus change notifications. If the specified listener is already registered, no<br />

change occurs.<br />

Parameters<br />

listener:Object - A new object with an onSetFocus method.<br />

Example<br />

In the following example, you create two input text fields at runtime, setting the borders for<br />

each text field to true. This code creates a new (generic) ActionScript object named<br />

focusListener. This object defines for itself an onSetFocus property, to which it assigns a<br />

function. The function takes two parameters: a reference to the text field that lost focus, <strong>and</strong><br />

one to the text field that gained focus. The function sets the border property of the text field<br />

that lost focus to false, <strong>and</strong> sets the border property of the text field that gained focus to<br />

true:<br />

this.createTextField("one_txt", 99, 10, 10, 200, 20);<br />

this.createTextField("two_txt", 100, 10, 50, 200, 20);<br />

544 ActionScript classes<br />

Gives focus to the selectable (editable) text field,<br />

button, or movie clip, that the newFocus parameter<br />

specifies.<br />

Sets the selection span of the currently focused<br />

text field.<br />

addProperty (Object.addProperty method), hasOwnProperty<br />

(Object.hasOwnProperty method), isPropertyEnumerable<br />

(Object.isPropertyEnumerable method), isPrototypeOf (Object.isPrototypeOf<br />

method), registerClass (Object.registerClass method), toString<br />

(Object.toString method), unwatch (Object.unwatch method), valueOf<br />

(Object.valueOf method), watch (Object.watch method)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!