play different frames onclick flash
===

I have 2 symbols in a frame: deer and man.
I want to stop the flash movie on frame 45 
and if user clicks on deer play frames 50-100
but if user clicks on man I want to play frame
200 - 250. The code I have in frame 45 is:


    stop();

    deer.addEventListener(MouseEvent.CLICK, onClickHandler);
    man.addEventListener(MouseEvent.CLICK, onClickHandler);

    private function onClickHandler(event : MouseEvent) : void {
        
        switch(event.target) {
        case deer:
            // code to execute when button 1 is clicked
            gotoAndPlay(50);
            break;

        case man:
            // code to execute when button 2 is clicked
            gotoAndPlay(200);
            break;

        }
    }
 but I get error `used outside class.
     private function onClickHandler(event : MouseEvent) : void`

I tried putting everything in a class like so:
        
    class Movie{
    
        //All the code in here

    }

but that didn't help just added more errors.

