# Keyboard event is not activated

**URL:** https://forum.kirupa.com/t/keyboard-event-is-not-activated/319447
**Category:** flash
**Created:** [February 21, 2011, 11:05am UTC](https://forum.kirupa.com/t/keyboard-event-is-not-activated/319447 "2011-02-21T11:05:06Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![soha\_20088](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@soha\_20088](https://forum.kirupa.com/u/soha_20088)
#### Post date: [February 21, 2011, 11:05am UTC](https://forum.kirupa.com/t/keyboard-event-is-not-activated/319447/1 "2011-02-21T11:05:06Z")

</div>

hi All,

I m creating a project of maze game in which have to use keyboard event.  
All the coding is done in as3 and i m using swc files in my project.  
When i published the swf, it shows me intro screen then it goes to game screen when i click on play button. Then the game screen gets loaded (i did addChild for this as i m using swc for each screen). Now the keyboard event should capture when any key is pressed.  
For this i wrote :  
Main.STAGE.addEventListener(KeyboardEvent.KEY\_DOWN , pressSpaceBar);  
Main.STAGE is a static variable stored in another .as file.

But the event is not firing on loading the game screen. It fires when i click anywhere on screen(screen selection).

Why this is happening ? and why the keyboard event is not firing ?  
can somebody plz help me out ?

-soha
