A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: How do i make a key press button

  1. #1
    Senior Member
    Join Date
    Mar 2005
    Location
    U.S.A . VA.
    Posts
    108

    How do i make a key press button

    Im trying to make a game that has arrow keys used at just the right time to make somthing diffrent happen in the time line, What im asking is:

    How Can i make some action script that lets me use arrow keys as like a button without stoping stardard play

    ~Example:~ A guy is runing down a bridge when a plank falls out. The character gets an explanion point above his head "!" and the player (You/Me) press the up key on that precise moment. >>Cause<< the up key made the time line skip to frame 48 (a few frames from that one) and makes it look like you made the jump.

    Please help me out!

    Thanks!! ^-^
    How can you say so much, but say so little?

  2. #2
    Moderator enpstudios's Avatar
    Join Date
    Jun 2001
    Location
    Tampa, Fl.
    Posts
    11,282
    Code:
    var myListner:Object;
    myListener = new Object();
    myListener.onKeyDown = function() {
    	if (Key.isDown(Key.UP)) {
    		_root.gotoAndPlay(48);
    	}
    };
    Key.addListener(myListener);

  3. #3
    Senior Member
    Join Date
    Mar 2005
    Location
    U.S.A . VA.
    Posts
    108
    Quote Originally Posted by estudioworks
    Code:
    var myListner:Object;
    myListener = new Object();
    myListener.onKeyDown = function() {
    	if (Key.isDown(Key.UP)) {
    		_root.gotoAndPlay(48);
    	}
    };
    Key.addListener(myListener);
    how can i use that for and up and and down arrow key at the same time? ::Edit::
    Last edited by Ecuder; 03-09-2006 at 09:09 PM.
    How can you say so much, but say so little?

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