Setfocus (Selection.setfocus Method) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

Parameters
- The object that will no longer receive focus notifications.
listener:Object
Returns
- If
Boolean
listener
was not successfully removed--for example, if
listener
object's listener list--the method returns a value of
Example
The following ActionScript dynamically creates several text field instances. When you select a
text field, information displays in the Output panel. When you click the
instance, the listener is removed and information no longer displays in the Output panel.
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";
}
}
var selectionListener:Object = new Object();
selectionListener.onSetFocus = function(oldFocus, newFocus) {
trace("Focus shifted from "+oldFocus+" to "+newFocus);
};
Selection.addListener(selectionListener);
remove_btn.onRelease = function() {
trace("removeListener invoked");
Selection.removeListener(selectionListener);
};
See also
addListener (Selection.addListener method)

setFocus (Selection.setFocus method)

public static setFocus(newFocus:Object) : Boolean
Gives focus to the selectable (editable) text field, button, or movie clip, specified by the
parameter. If
newFocus
was successfully removed, the method returns a
or
is passed, the current focus is removed.
null
undefined
was not on the Selection
listener
.
false
value. If
true
remove_btn
Selection
1077

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF