Featured Tutorials

flash tutorials, fireworks, particle effects, flash animation,fireworks in flash,creating fireworks,fireworks movie,fireworks display,how to create fireworks,flash fireworks tutorial,fireworks tutorial Flash Firework Frenzy

Flash Firework Frenzy

Create a realistic particle based firework display using Flash. This technique was once us..

where to submit,tutorial sites,articles,directories,submission,site promotion, submit artilcles,photoshop tutorial sites,flash tutorial sites,promote tutorials,best tutorial sites Build Traffic Mountains, great places to submit your Tutorials and Articles

Build Traffic Mountains, great places to submit your Tutorials and Articles

A list of great sites to submit your tutorials and articles that actually bring traffic to..

flash gallery,rotating gallery,dynamic flash,dynamic gallery,flash based gallery,flash image changing,change images Dynamic Rotating Gallery in Flash

Dynamic Rotating Gallery in Flash

This tutorial will teach you how to create a dynamic rotating gallery within flash for sho..

photoshop,line art,vector,tutorial,vector art,drawning in photoshop,drawing vector,how to draw line art,how to draw vector,photoshop drawing,drawing tutorial,pen tool,brush tools,drawing brushes Turning Photographs into Vector Line Art

Turning Photographs into Vector Line Art

Learn how to transform a standard portrait facial photograph into stylish vector line art...

change,colour,quick mask,masks,photoshop masks,hair,photoshop,hair in photoshop,change hair,change hair colour,change hair color,hair colour in photoshop,change hair,color hair,colour hair Change the Colour of Hair in Photoshop

Change the Colour of Hair in Photoshop

This Photoshop tutorial will teach you how to change the colour of hair. This effect is fa..

Featured Videos

Another amazing video showing how easy it is to change a persons ..

Learn how to create 3d spinning animated text with thie Swift 3D ..

A useful tutorial for creating an Ethernet or Patch Cable for net..

Heres some great inspiration for logo design with examples of mod..

In this video Jeremy of Shoemoney.com explains how he experimente..

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