# Compile-time Constant annoying error

**URL:** <https://forum.kirupa.com/t/compile-time-constant-annoying-error/326748>\
**Category:** flash\
**Created:** [January 9, 2012, 9:38pm UTC](https://forum.kirupa.com/t/compile-time-constant-annoying-error/326748 "2012-01-09T21:38:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MFRS](https://avatars.discourse-cdn.com/v4/letter/m/aca169/32.png) [@MFRS](https://forum.kirupa.com/u/MFRS)\
**Post date:** [January 9, 2012, 9:38pm UTC](https://forum.kirupa.com/t/compile-time-constant-annoying-error/326748/1 "2012-01-09T21:38:49Z")

</div>

I have a character added as Child in the Main Time line and i am trying to make a class for that same char to control it, but as soon as i start it gives me this huge annoying error that says It has a compile time-constant error in the

```
private function checkKeysDown(event:KeyboardEvent):void{

```

Full class code below

```auto
package {
    
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    import flash.events.Event;
    
    
    public class personagem extends MovieClip {
        
            private var leftKeyDown:Boolean = false;
            private var upKeyDown:Boolean = false;
            private var rightKeyDown:Boolean = false;
            private var downKeyDown:Boolean = false;
        public function personagem() {
            addEventListener(Event.ADDED, beginClass);
            
        }
    private function beginClass (event:Event) :void{
        stage.addEventListener(KeyboardEvent.KEY_DOWN, checkKeysDown);
    }
    
    
    private function checkKeysDown(event:KeyboardEvent):void{
    
    if(event.keyCode == 37 || event.keyCode == 65){
        leftKeyDown = true;
    }
    if(event.keyCode == 38 || event.keyCode == 87){
        upKeyDown = true;
    }
    if(event.keyCode == 39 || event.keyCode == 68){
        rightKeyDown = true;
    }
    if(event.keyCode == 40 || event.keyCode == 83){
        downKeyDown = true;
    }
}
    }
    
}

```
