578
ActionScript classes
Returns
String
- A string or
null
.
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()+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)
,
setFocus
(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
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...