Featured Tutorials

flash tutorials, iris window, enter button, animated porthole,iris in flash,iris illustration,drawing an iris,iris in flash,flash iris,flash tutorial,iris tutorial Iris Porthole Door Animation in Flash

Iris Porthole Door Animation in Flash

Very cool effect that could be used for an intro or as an enter button for any web site...

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..

text effects,glass text,glassy text,sky style text,sky logo text,sky logo font,text effects photoshop,photoshop tutorial,blending options Text Effects #6 Sky Logo Style Glass Text

Text Effects #6 Sky Logo Style Glass Text

This simple tutorial will teach you how to use the blending options in Adobe Photoshop to ..

New, Year, Screen, Saver, create 3 Ways to Create New Year Screen Saver

3 Ways to Create New Year Screen Saver

3 Ways to create New Year screen saver for your computer. You could add make an animated s..

graphics design tutorials, how to design logos, logo design,flash drawing,drawing in flash,design in flash,logo illustration,how to logo design,easy logo design,how to design logos,logos,flash logos Tips and tricks for designing logos

Tips and tricks for designing logos

How to design a logo covering some good font techniques, how to get inspiration, playing w..

Featured Videos

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

Interesting artistic video of what happens when you write an emai..

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

One of the best computer based drawings I've seen, this video tak..

Google Analytics is one of the most important tools you can use i..

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