A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: using keyboard for movement - eliminating the slight pause

  1. #1
    Yeah...I'm gellin'.
    Join Date
    Nov 2003
    Location
    Slightly NorthWest of Chicago
    Posts
    70

    using keyboard for movement - eliminating the slight pause

    As some of you may know, there is a slight pause after you hold in one key, so the computer knows wether to enter it in again or not. Once it decides you want tons of that letter in the text, then it rapidly speeds up. (If you don't know what I'm talking about, go to your URL bar and press and hold a, look for that pause.)

    My source code, which reads (translated): Upon holding in the <Right> key, _x += 2.

    I've noticed that same slight pause while holding in the <Right> key, and that offsets the movement by quite a bit.

    I would like a solution that gets rid of the pause and, most importantly, works for all computers (aka doesn't involve changing keyboard controls manually).

    Any ideas?
    Last edited by Rellin; 03-05-2005 at 11:14 AM.

  2. #2
    Senior Member
    Join Date
    Jun 2004
    Posts
    193
    whats your actual source code?

    i used this :

    PHP Code:
    if (Key.isDown(KEY.RIGHT)) {
            
    _x +=5
    and that works fine without the pause or anything,

    Im using mx2004 btw,

    beedle

  3. #3
    Yeah...I'm gellin'.
    Join Date
    Nov 2003
    Location
    Slightly NorthWest of Chicago
    Posts
    70
    I was using on(keyPress("<Left>")){ as my code. I can't get yours to work. In what on/onClipEvent handler do I put it in?

  4. #4
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    He's probably doing it in an enterframe handler, like so:

    code:

    onClipEvent(enterFrame)
    {
    if (Key.isDown(Key.LEFT))
    {
    // handle left key
    }
    if (Key.isDown(Key.RIGHT))
    {
    // handle right key
    }
    // etc...
    }



    This tends to work better for games...

  5. #5
    Senior Member
    Join Date
    Jun 2004
    Posts
    193
    Yea, im using an onClipEvent(EnterFrame) handler,

    beedle

  6. #6
    Yeah...I'm gellin'.
    Join Date
    Nov 2003
    Location
    Slightly NorthWest of Chicago
    Posts
    70
    aaaah, I should've known that.


    Thanks much!

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