Onsetfocus (Selection.onsetfocus Event Listener) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

Example
The following example displays the currently focused selection's 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:Object], [newfocus:Object]) {}
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 Player 6
Parameters
[optional] - The object losing focus.
oldfocus:Object
[optional] - The object receiving focus.
newfocus:Object
,
setFocus
Selection
1075

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