NAVIGATION:

 

SUPPORTERS:

FlashComponents
  Flash Templates
  Flash Gallery
  Flash Slideshow
  Flash Menu
  Flash Design
  Flash Video
  User Interface

 

FOLLOW:

RSS it down! Twitter it up! Facebook it like a fiend!

 

 

Multiple Key Detection
       code by Michael Avila, written by Kirupa  |  3 April 2006

If you frequent the Source/Experiments forum, chances are that you have run into Michael Avila's (MichalxxOA) experiments. This tutorial is based on Michael's Multiple Key Detection script, and by reading this tutorial, I hope you will learn not only how Michael created the multiple key detection functionality but also tips on how you can use it and modify it for your own projects.

Whenever you use keyboard shortcuts, you are holding and pressing several keys consecutively. Have you ever thought about how this functionality actually works? What causes your computer to realize that when you press the N key while holding down the Ctrl key, you meant to type Ctrl + N as opposed to each key separately?

While the answers to the above questions depend largely on the implementation of the multiple key detection, the overall idea behind them is the same - keep track of keys pressed and check whether the pressed keys map to a valid shortcut.

The following is an animation implementing the Multiple Key Detection script you will learn about in this tutorial. Click on the GO button in the animation below and press the Ctrl + K keys to randomly keep displaying the letter K:

[ click GO in the above animation and press Ctrl + K ]

Beyond explaining how to detect multiple keys, this tutorial also covers the following high-level topics:

  • Accessing Data stored in Multidimensional Arrays
  • Using Classes
  • Understanding Somebody Else's Code

If you are a beginning Flasher, this tutorial might be a little complicated. Don't worry though, the following tutorials on Object Oriented Programming and Arrays should prepare you well for what lies ahead in the following pages. I will also provide enough tips and clarifications so that you won't be lost.

The tutorial is broken into the following sections:

  1. How to Use
  2. Code Explanation
  3. Conclusion

The following pages will take you through each of the sections and hopefully teach you something that you might not have known about before.

Onwards to the next page!

1 | 2 | 3 | 4 | 5 | 6 | 7

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
The Text Animation Component for Flash CS3
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
The best flash components ever! Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Learn how to advertise on kirupa.com

cdn
content delivery network (cdn)