610
Chapter 7: ActionScript for Flash
MovieClip.onSetFocus
Availability
Flash Player 6.
Usage
my_mc
.onSetFocus = function(
oldFocus
){
// your statements here
}
Parameters
oldFocus
The object to lose focus.
Returns
Nothing.
Description
Event handler; invoked when a movie clip receives keyboard focus. The
oldFocus
parameter is
the object that loses the focus. For example, if the user presses the Tab key to move the input
focus from a movie clip to a text field,
oldFocus
contains the movie clip instance.
If there is no previously focused object,
oldFocus
contains a
null
value.
You must define a function that executes when the event handler in invoked. You can define the
function on the Timeline or in a class file that extends the MovieClip class or is linked to a symbol
in the library.
Example
The following example writes information about the movie clip that receives keyboard focus, and
the instance that previously had focus. Two movie clips, called
my_mc
and
other_mc
are on the
Stage. Add the following ActionScript to your AS or FLA document:
my_mc.onRelease = Void;
other_mc.onRelease = Void;
my_mc.onSetFocus = function(oldFocus) {
trace("onSetFocus called, previous focus was: "+oldFocus);
};
Tab between the two instances, and information writes to the log file.
See Also
MovieClip.onKillFocus
Summary of Contents for FLEX-FLEX ACTIONSCRIPT LANGUAGE
Page 1: ...Flex ActionScript Language Reference...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Page 135: ...case 135 See also break default strict equality switch...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Page 808: ...808 Chapter 7 ActionScript for Flash...
Page 810: ...810 Appendix A Deprecated Flash 4 operators...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Page 822: ...822 Index...