Limiting Keyboard input in held down state(it queues too much)
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Limiting Keyboard input in held down state(it queues too much)

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Posts
    4

    Limiting Keyboard input in held down state(it queues too much)

    Hey guys,

    I am extremely new to flash and I can't provide the things you ask for, only ask the question I came to ask.

    When animating in flash, there is a way to make flash register a held down key and when it is released again. This is all good and well, but it seems that somewhere in flash there is still a long queue of input in what ideally should be 2 instances, key press and release.

    Is there any way to completely avoid flash making that unnecessary queue of input?

  2. #2
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    665
    it's not the flash, it's the operating system. you get tons of key_down-s and one key_up. typically people do something like keyPressed[event.keyCode()] = true; on key_down and false on key_up, and then in the loop: if (keyPressed[some_key_code]) { /* do something */ } so that the app does not care how many times key_down was received.

  3. #3
    Junior Member
    Join Date
    Sep 2013
    Posts
    4
    It only happens in flash, if it was the OS wouldn't it happen when programming in other protocols as well?

  4. #4
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    665
    well for me it does happen everywhere. if I open text editor and hold T key down, I end up with the line like TTTTTTTTTTTTTTTTTTTT

  5. #5
    Junior Member
    Join Date
    Sep 2013
    Posts
    4
    It is supposed to repeat on in the held state in a text editor. If you open any program, a game, a music application, it will always repeat the key in a held state? In my experience it only does so in programs when there's a reason to.

    I know someone who is coding flash games. He knows what he is doing, is a veteran in coding and in flash. The more advanced games of his will start to lag if you hold a key for too long because it repeatedly sends input to flash in spite of using the key Up/Down(held or not held) commands. It can even be remedied by going to settings in windows and reducing the speed of key repetition when held.

    This tells me that flash is receiving input and doing something it shouldn't with it in spite of him programming in a sensible way.
    Last edited by AtotehZ; 09-08-2013 at 05:27 PM.

  6. #6
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    665
    Sorry you didn't like my answer.

  7. #7
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    958
    Hi,

    I can think of possibly three things you can try.

    1. Use a character restrict on your text field: myText.maxChars = 20;

    2. Ask your advanced Flash gamer friend how he does it.

    3. There may be another way.

    Good luck.

  8. #8
    Junior Member
    Join Date
    Sep 2013
    Posts
    4
    Thank you both of you. I will report back with what happens.

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

Poll by Flashkit.com