Key.addListener( ) Method | Flash 6 |
registers an object to receive onKeyDown( ) and onKeyUp( ) events |
An object with a defined onKeyDown( ) and/or onKeyUp( ) method.
The addListener( ) method adds listener to the list of objects notified when Key's onKeyDown( ) and onKeyUp( ) events occur. The listener is an object of any class that defines methods by the name onKeyDown and/or onKeyUp; these need not be built-in methods of the object but can instead be custom-defined. The methods are invoked when the corresponding event occurs for Key. To stop a listener object from receiving events, use Key.removeListener( ).
Multiple objects can respond independently to each Key event. When multiple listeners are registered to Key, their methods are invoked in the order the listeners were added.
For general information on how listeners and callback functions work, see Chapter 10. For sample Key listener code, see Key.getAscii( ) and Key.onKeyDown( ).
Key.getAscii( ), Key.onKeyDown( ), Key.onKeyUp( ), Key.removeListener( ); Chapter 10