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.

A reference to the text field instance is passed as a parameter to the onChanged h<strong>and</strong>ler. You<br />

can capture this data by putting a parameter in the event h<strong>and</strong>ler method. For example, the<br />

following code uses textfield_txt as the parameter that is passed to the onChanged event<br />

h<strong>and</strong>ler. The parameter is then used in a trace() statement to send the instance name of the<br />

text field to the Output panel:<br />

this.createTextField("myInputText_txt", 99, 10, 10, 300, 20);<br />

myInputText_txt.border = true;<br />

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

myInputText_txt.onChanged = function(textfield_txt:TextField) {<br />

trace("the value of "+textfield_txt._name+" was changed. New value is:<br />

"+textfield_txt.text);<br />

};<br />

The onChanged h<strong>and</strong>ler is called only when the change results from user interaction; for<br />

example, when the user is typing something on the keyboard, changing something in the text<br />

field using the mouse, or selecting a menu item. Programmatic changes to the text field do not<br />

trigger the onChanged event because the code recognizes changes that are made to the text<br />

field.<br />

Parameters<br />

changedField:TextField - The field triggering the event.<br />

See also<br />

getNewTextFormat (TextField.getNewTextFormat method), setNewTextFormat<br />

(TextField.setNewTextFormat method)<br />

onKillFocus (TextField.onKillFocus h<strong>and</strong>ler)<br />

onKillFocus = function(newFocus:Object) {}<br />

Invoked when a text field loses keyboard focus. The onKillFocus method receives one<br />

parameter, newFocus, which is an object representing the new object receiving the focus. If no<br />

object receives the focus, newFocus contains the value null.<br />

Parameters<br />

newFocus:Object - The object that is receiving the focus.<br />

Example<br />

The following example creates two text fields called first_txt <strong>and</strong> second_txt. When you<br />

give focus to a text field, information about the text field with current focus <strong>and</strong> the text field<br />

that lost focus is displayed in the Output panel.<br />

TextField 629

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

Saved successfully!

Ooh no, something went wrong!