Featured Tutorials

flash tutorials, animated eyes, follow mouse, interactivity,eyes in flash,eyes that follow,eye tracking,animate eyes,photos of eyes,womans eyes Realistic Eye Animation

Realistic Eye Animation

Create animated eyes that blink, wink and following the mouse pointer using Flash...

icon design,icons in illustrator,illustrator tutorial,how to design icon,icon from sketch,gradient effects,gradient colouring,drawing in illustrator,stumble upon icon How to Design a 3D Icon in Illustrator

How to Design a 3D Icon in Illustrator

This very detailed tutorial will take your through the stages of creating a 3D stumble upo..

Adobe, Photoshop, Effects, Text, 3D, Metallic 3D Magnetic Text Effect

3D Magnetic Text Effect

Tutorial on making a great flying 3D effect of a letter giving magnetic field effect and a..

hardware articles, CD, DVD, cleaning, home remedy,cds with toothpaste,toothpaste,clean with toothpaste,dvds toothpaste,clean dvd,how to clean cds,how to clean dvd,dvd cleaner Clean your CD's/DVD's with toothpaste!

Clean your CD's/DVD's with toothpaste!

The low-cost answer to keeping your CD's/DVD's clean and functional...

Image, transition, effect, flash, tutorials Image transition effect

Image transition effect

This Flash tutorial will teach you how to create an image transition effect. This effect c..

Featured Videos

A great example of how the many Photoshop tools can be used to im..

This detailed video will show you how to configure the third part..

Heres a great spoof video for the technically challenged develope..

Heres a cool tutorial slash speed painting of painting realistic ..

Foto Flexer is an amazing tool allows you to resize photos dynami..

Flash Detect Keyboard Input with Key Listeners

Heres another helpful bit of flash actionscript code to help you on your way with developing dynamic flash content.

 

Key Listeners

Key Listeners allow you to record the input of keys from the keyboard in flash and allow you to peform actions with keys

First you need to setup your key listener as a function as follows:


KeyListener = new Object();
KeyListener.onKeyDown = function() {
if (Key.getAscii() == 13) { // Code for ENTER key
gotoAndPlay(25);
} else if (Key.getAscii() == 8) { // Code for BACKSPACE key
gotoAndPlay(35);
}
}

 

Then either after the function or on another frame where you want the key listender to start simply add this code:


Key.addListener(KeyListener);

 

Detecting if "Any Key" is pressed


this.createEmptyMovieClip("_keyListener",1);
Key.addListener(_keyListener);
_keyListener.onKeyDown=function(){
play();
}

 

Useful Key ASCII/ALT Codes

ENTER

13

BACKSPACE

8

SHIFT

16

CTRL

17

ALT

18

0

48

1

49

2

50

3

51

4

52

5

53

6

54

7

55

8

56

9

57

Arrow Keys (left)

37

Arrow Keys (up)

38

Arrow Keys (right)

39

Arrow Keys (down)

40



More Flash...

Other Content...

 Subscribe to our feed

Send to a friend