Featured Tutorials

photoshop tutorials, gradient filter, photo effects, brand image,gradient mapping,gradients in photoshop,gradient colours,photo gradients,gradient photo,gradient filter,photoshop filters Gradient Mapping

Gradient Mapping

How to transform a standard photograph for use with a specific colour scheme or brand imag..

web design articles, html, css, php, asp, include function,include in php,include in asp,including files,html include,asp include,php include,how to design websites,websites tutorial Building your website with includes

Building your website with includes

Using server side includes to design and code your web site allows you to keep your develo..

crop,target,property,flash,tutorial,drag drop,drag flash,flash drag,hittest,collision,overlap,flash tutorial,movieclip overlap The Drop target property in Flash

The Drop target property in Flash

This flash tutorial will teach you about the drop target property. The drop target propert..

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

photoshop grass,photoshop tutorial,grass texture,grassy texture,ground texture,textures,green texture,create textures,texture tutorial Grass Textures in Photoshop using Filters

Grass Textures in Photoshop using Filters

Its amazing what you can get from using a combination of different filter in Photoshop. Th..

Featured Videos

This tutorial will teach you some of the basics of the third part..

Sorenson Squeeze is a great piece fo software that has saved my a..

I never realised how easy it can be to create some really amazing..

Heres a very cool time-lapse tutorial for 3D Studio Max that show..

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

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