onKeyDown « Actionscript Programming « Flash Tutorials

Home
Flash Tutorials
1.Actionscript Programming
2.Animals
3.Animation
4.Colors
5.Design
6.Effects
7.Game Cartoon
8.Humans
9.Models
10.Nature
11.Operations
12.Shapes
Photoshop Tutorials
Maya Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
Flash Tutorials » Actionscript Programming » onKeyDown 
Does not output the words "Key was pressed" in the output window, whenever i press a key on the keyboard. This is because the onKeyDown event handler for movieclips differs from the onClipEvent(keyDown){} event handler, the Flash MX onKeyDown event handler requires the movieclip to be focused before the event is fired. So, if i want to run some code everytime a key is pressed on the key board, we can either use the old Flash 5 Event handler onClipEvent(KeyDown){}, or we can listen globally for the event notification, this means you have to subscribe the movieclip to the Key objects event notification as follows:

w_w___w.__j_a__v__a_2___s___.___co__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.