Key.removeListener()
Availability
Flash Player 6.
Usage
Key.removeListener (listener:Object) : Boolean
Parameters
An object.
listener
Returns
If the
listener
successfully removed (for example, because the
the method returns
Description
Method; removes an object previously registered with Key.addListener().
Example
The following example moves a movie clip called
The listener is removed when you press Escape, and
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
switch (Key.getCode()) {
case Key.LEFT :
car_mc._x -= 10;
break;
case Key.RIGHT :
car_mc._x += 10;
break;
case Key.ESCAPE :
Key.removeListener(keyListener);
}
};
Key.addListener(keyListener);
was successfully removed, the method returns
.
false
. If the
true
was not on the Key object's listener list),
listener
using the Left and Right arrow keys.
car_mc
no longer moves.
car_mc
was not
listener
Key.removeListener()
365
Need help?
Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?
Questions and answers