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.

one_txt.border = true;<br />

one_txt.type = "input";<br />

two_txt.border = true;<br />

two_txt.type = "input";<br />

var focusListener:Object = new Object();<br />

focusListener.onSetFocus = function(oldFocus_txt, newFocus_txt) {<br />

oldFocus_txt.border = false;<br />

newFocus_txt.border = true;<br />

};<br />

Selection.addListener(focusListener);<br />

See also<br />

setFocus (Selection.setFocus method)<br />

getFocus (Selection.getFocus method)<br />

public static getFocus() : String<br />

Returns a string specifying the target path of the object that has focus.<br />

■ If a TextField object has focus, <strong>and</strong> the object has an instance name, the getFocus()<br />

method returns the target path of the TextField object. Otherwise, it returns the<br />

TextFields variable name.<br />

■ If a Button object or button movie clip has focus, the getFocus() method returns the<br />

target path of the Button object or button movie clip.<br />

■ If neither a TextField object, Button object, Component instance, nor button movie clip<br />

has focus, the getFocus() method returns null.<br />

Returns<br />

String - A string or null.<br />

Example<br />

The following example creates a text field to output the path of the currently focused object.<br />

It then uses an interval function to periodically update the field. To test this, add several<br />

button instances to the stage with different instance names, <strong>and</strong> then add the following<br />

ActionScript to your AS or FLA file.<br />

this.createTextField("status_txt", this.getNextHighestDepth(), 0, 0, 150,<br />

25);<br />

function FocusUpdate()<br />

{<br />

s = Selection.getFocus();<br />

if ( s )<br />

Selection 545

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

Saved successfully!

Ooh no, something went wrong!