# Problem in custom class

**URL:** <https://forum.kirupa.com/t/problem-in-custom-class/320353>\
**Category:** Uncategorized\
**Created:** [March 21, 2011, 2:58pm UTC](https://forum.kirupa.com/t/problem-in-custom-class/320353 "2011-03-21T14:58:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![taint](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@taint](https://forum.kirupa.com/u/taint)\
**Post date:** [March 21, 2011, 2:58pm UTC](https://forum.kirupa.com/t/problem-in-custom-class/320353/1 "2011-03-21T14:58:26Z")

</div>

i got error for this code would anyone help me??  
//Syntax error: expecting rightparen before dot.  
the error is eclose with :ex:

package {

```
import flash.display.Stage;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;

public class navigate extends MovieClip {
    private var hero:MovieClip = new hero_class;

    public function navigate() {
        // constructor code
        hero.x = stage.stageHeight / 2;
        hero.y = stage.stageHeight / 2;
        addChild(hero);
        stage.addEventListener(KeyboardEvent.KEY_DOWN, onpress);
        //stage.addEventListener(KeyboardEvent.KEY_UP, onrelease);
        
    }
:ex: private function onpress(event.KeyboardEvent):void{ :ex:
        var ascii:uint = event.keyCode;
        var step1:uint = 4;
        var step2:uint = 7;
        if(Keyboard.R == true){
            switch(ascii){
                case Keyboard.LEFT :
                    hero.x -= step2;
                    break;
                case Keyboard.RIGHT :
                    hero.x += step2;
                    break;
                case Keyboard.UP :
                    hero.y -= step2;
                    break;
                case Keyboard.DOWN :
                    hero.y += step2;
                    break;
            }
        }
        else
            switch(ascii){
                case Keyboard.LEFT :
                    hero.x -= step1;
                    break;
                case Keyboard.RIGHT :
                    hero.x += step1;
                    break;
                case Keyboard.UP :
                    hero.y -= step1;
                    break;
                case Keyboard.DOWN :
                    hero.y += step1;
                    break;
            }
    }

}

```

}
