# Need Help powering-up an object with KeyEvent like the plunger in PinBall

**URL:** <https://forum.kirupa.com/t/need-help-powering-up-an-object-with-keyevent-like-the-plunger-in-pinball/178323>\
**Category:** Uncategorized\
**Created:** [February 9, 2006, 1:24pm UTC](https://forum.kirupa.com/t/need-help-powering-up-an-object-with-keyevent-like-the-plunger-in-pinball/178323 "2006-02-09T13:24:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![KyMrn](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kymrn/32/18801_2.png) [@KyMrn](https://forum.kirupa.com/u/KyMrn)\
**Post date:** [February 9, 2006, 1:24pm UTC](https://forum.kirupa.com/t/need-help-powering-up-an-object-with-keyevent-like-the-plunger-in-pinball/178323/1 "2006-02-09T13:24:23Z")

</div>

I’m creating a Golf game and I have several \_mc’s with a golfer swinging a club…front view, side view, back view… I have them set up so the user can move the golfer around the screen with the arrowKeys. The spacebar activates the golfer to swing the club…But I would like the user to have more control over the amount of swing the golfer can take…ie. (full-swing, half-swing, quarter-swing, etc.)I have played several games were the space bar can be depressed for a few seconds to power up an object…the first one that comes to mind is PinBall, were the plunger is pulled back slightly with holding down the spbar for a short time, or it is pulled way back the longer you hold the spbar down. The code I have now is a basic KeyEvent Listner…  
keyListener = new Object();  
keyListener.onKeyDown=function(){  
if(Key.isDown(Key.SPACE)){  
gotoAndPlay(2);  
}  
}  
Key.addListener(keyListener);

I have searched through a ton of Tutorials out there, and no where is there an explaination on how to make this happen.

Thanks for anyone’s help in advance!
