Selection
579
Parameters
oldfocus
:
[optional] - The object losing focus.
newfocus
:
[optional] - The object receiving focus.
Example
The following example demonstrates how to determine when input focus changes in a SWF
file between several dynamically created text fields. Enter the following ActionScript into a
FLA or AS file and then test the document:
this.createTextField("one_txt", 1, 0, 0, 100, 22);
this.createTextField("two_txt", 2, 0, 25, 100, 22);
this.createTextField("three_txt", 3, 0, 50, 100, 22);
this.createTextField("four_txt", 4, 0, 75, 100, 22);
for (var i in this) {
if (this[i] instanceof TextField) {
this[i].border = true;
this[i].type = "input";
}
}
this.createTextField("status_txt", this.getNextHighestDepth(), 200, 10,
300, 100);
status_txt.html = true;
status_txt.multiline = true;
var someListener:Object = new Object();
someListener.onSetFocus = function(oldFocus, newFocus) {
status_txt.htmlText = "<b>setFocus triggered</b>";
status_txt.ht= "<textformat tabStops='[20,80]'>";
status_txt.ht= " \toldFocus:\t"+oldFocus;
status_txt.ht= " \tnewFocus:\t"+newFocus;
status_txt.ht= " \tgetFocus:\t"+Selection.getFocus();
status_txt.ht= "</textformat>";
};
Selection.addListener(someListener);
See also
addListener (Selection.addListener method)
,
setFocus (Selection.setFocus
method)
Summary of Contents for Flash Lite 2
Page 1: ...Flash Lite 2 x ActionScript Language Reference...
Page 22: ...22 Contents...
Page 244: ...244 ActionScript language elements...
Page 760: ...760 ActionScript classes...