A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Key Press help?????

  1. #1
    Junior Member
    Join Date
    Jan 2001

    Key Press help?????

    hi anyone

    I have seen this cool link: http://www.addb.ro/ and tried to make a similar menu but without any luck. I made a movieclip that do the animation up and down. On that I made a "onClipEvent-function" where I hit a key to making the "menu" drop down. The problem is that if I'm holding down the key it doesn't stop but keep on playing so the menu-animation are closing again.

    How can I fix that or is there an easier way to do it?

    Please contact me on: jacob@flyart.dk



  2. #2
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Out In The Pasture
    Did you add a stop to the last frame of the menu animation? And what code did you use?

  3. #3
    Senior Member
    Join Date
    Jul 2001
    Planet Earth

    No tweens included

    They made a movie clip that sits just above the stage with an enterFrame script that checks to see if the shift button is down, if so increase the the _y of the clip until it is 0 (meaning its top is even with the top of the stage). If the condition fails (the shift button is let go) the _y is decreased until the movie clip is just above the stage.

    I got it to work with this code on the first frame.
    // menu is the name of the movie clip
    menu.onEnterFrame = function() {
            // make it come down
    	if (Key.isDown(Key.SPACE)){
    		if (menu._y < 0){
    			menu._y += 50;
            // make it go back up
    	} else {
    		if (menu._y >-294) {
    			menu._y -= 50;
    The -294 came from me physically moving the movie clip up above the top of the stage and looking at the property bar to see what the y coordinate was. Yours most likely will be different.

    Hope that helps!
    Attached Files Attached Files
    Thinking outside of the box will get you fired if the "box" is strict budget.

  4. #4
    Junior Member
    Join Date
    Jan 2001
    Thanks guys...

    I've found out and it's working fine but thanks a lot for the reply's.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center