Adding stage on the class

i’ve been getting difficulties regarding how to put a stage on a .AS
how should i declare it? I want to put my movie clip on the stage using a class only. i want my hero to go at the middle of the screen but it doesnt come out.

here’s my current code


package  {
    
    import flash.display.Stage;
    import flash.display.MovieClip;
    import flash.events.Event;

    public class hero_class extends MovieClip {
        
        public function hero_class() {
            init();
        }
        private function init(){
            addEventListener(Event.ADDED_TO_STAGE, onStage);
        }
        
        private function onStage(e:Event){
            addEventListener(Event.ENTER_FRAME, onEnter);
        }
        
        private function onEnter(e:Event){
            this.x = stage.stageWidth/2;
            this.y = stage.stageHeight/2;
            addChild(this);
        }

    }
    
}