Featured Tutorials

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

photoshop tutorials, gradient overlay, text effects,photoshop text effects,font effects,text reflection,reflections,custom text,blending options,text effects in photoshop Jazz up text with Gradient Overlay

Jazz up text with Gradient Overlay

Some simple Photoshop techniques for giving your text and little oooomph!..

graphics design,business cards,business card design,business card ideas,how to design, business card sizes,layouts Ideas for Business Card Layouts

Ideas for Business Card Layouts

Heres a few ideas for those struggling to come up with professional business card designs,..

realistic,graffiti,photoshop,grafiti,grafitti,,photo,photograph,texture,wall textures,how to graffiti,grafitti in photoshop,photoshop brushes,custom brushes Adding Realistic Graffiti to a Photograph in Photoshop

Adding Realistic Graffiti to a Photograph in Photoshop

This tutorial will show you how to add realistic looking graffiti to a photograph or wall ..

vector photos,vector art,pen tool,photoshop,photoshop pen tool,pen tool illustration,vector pen tool,vector illustration,vector in photoshop How to Vector Illustrate a Photo with the Pen Tool in Photoshop

How to Vector Illustrate a Photo with the Pen Tool in Photoshop

This very detailed tutorial will show you some of the techniques you will need for transfo..

Featured Videos

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

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

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