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.

}<br />

{<br />

}<br />

status_txt.text = s;<br />

setInterval( FocusUpdate, 100 );<br />

See also<br />

onSetFocus (Selection.onSetFocus event listener), setFocus<br />

(Selection.setFocus method)<br />

onSetFocus (Selection.onSetFocus event listener)<br />

onSetFocus = function([oldfocus], [newfocus]) {}<br />

Notified when the input focus changes. To use this listener, you must create a listener object.<br />

You can then define a function for this listener <strong>and</strong> use the Selection.addListener()<br />

method to register the listener with the Selection object, as in the following code:<br />

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

someListener.onSetFocus = function () {<br />

// statements<br />

}<br />

Selection.addListener(someListener);<br />

Listeners enable different pieces of code to cooperate because multiple listeners can receive<br />

notification about a single event.<br />

Parameters<br />

oldfocus: [optional] - The object losing focus.<br />

newfocus: [optional] - The object receiving focus.<br />

Example<br />

The following example demonstrates how to determine when input focus changes in a SWF<br />

file between several dynamically created text fields. Enter the following ActionScript into a<br />

FLA or AS file <strong>and</strong> then test the document:<br />

this.createTextField("one_txt", 1, 0, 0, 100, 22);<br />

this.createTextField("two_txt", 2, 0, 25, 100, 22);<br />

this.createTextField("three_txt", 3, 0, 50, 100, 22);<br />

this.createTextField("four_txt", 4, 0, 75, 100, 22);<br />

for (var i in this) {<br />

if (this[i] instanceof TextField) {<br />

this[i].border = true;<br />

this[i].type = "input";<br />

546 ActionScript classes

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

Saved successfully!

Ooh no, something went wrong!