Two keys!?

  • 17 years ago

    I was wondering if there's a way to allow two keys to be pressed to enable one action... "if (Key.isDown(87)" allows that if "W" is pressed it performs the following IF statement. I would have thought "if ((Key.isDown(87) and (Key.isDown(83))" would allow the following IF statement to perform it's action if W and S were pressed. However, this doesn't appear to be the case. Why not?? Please help me with what I need to do to allow a two key press action.


    Thanks in advance...

  • 17 years ago

    eeeek s'a while since i've used ActionScript....... (it was me that recommended the section for it in this forum.... thank you fans, bows)...


    try putting one IF statement inside another, eg.

    Code:
    if (Key.isDown(87))
      if (Key.isDown(83))
         {do something}
    hope that works.

  • 17 years ago

    You know... That is SO obvious... And I don't know why I didn't think of it... In the main scene of the application I've used the same code!!! How stupid of me!! Anyway, thank you very much! lol

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Owning a computer without programming is like having a kitchen and using only the microwave oven” - Charles Petzold