Onsetfocus (Selection.onsetfocus Event Listener) - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
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

Table of Contents