Onsetfocus (Selection.onsetfocus Event Listener) - MACROMEDIA FLASHLITE2 ACTIONSCRIPT-LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

Returns
- A string or
String
Example
The following example displays the currently focused selections target path in a TextArea
component instance. Add several component instances or button, text field and movie clip
instances to the Stage. Add several component instances or button, text field and movie clip
instances to your SWF file. Then add the following ActionScript to your AS or FLA file.
var focus_ta:mx.controls.TextArea;
my_mc.onRelease = function() {};
my_btn.onRelease = function() {};
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.SPACE)) {
focus_ta.text = Selection.getFocus()+newline+focus_ta.text;
}
};
Key.addListener(keyListener);
Test the SWF file, and use Tab to move between the instances on the Stage. Make sure you
have Control > Disable Keyboard Shortcuts selected in the test environment.
See also

onSetFocus (Selection.onSetFocus event listener)

(Selection.setFocus method)
onSetFocus (Selection.onSetFocus event listener)
onSetFocus = function([oldfocus], [newfocus]) {}
Notified when the input focus changes. To use this listener, you must create a listener object.
You can then define a function for this listener and use Selection.addListener() to register the
listener with the Selection object, as in the following code:
var someListener:Object = new Object();
someListener.onSetFocus = function () {
// statements
}
Selection.addListener(someListener);
Listeners enable different pieces of code to cooperate because multiple listeners can receive
notification about a single event.
Availability: ActionScript 1.0; Flash Lite 2.0
578
ActionScript classes
.
null
,
setFocus

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash lite 2

Table of Contents