Refering to previously made variables

I’m having a problem trying to refer to a previously declared variable. I keep getting “1120: Access of undefined property z.”

    
    public class particleMainClass extends MovieClip {
        
        public function particleMainClass() {
            mc_1.addEventListener(Event.ENTER_FRAME, addOneToCounter)
            var z = 0
        }
    }
    
    private function addOneToCounter(e:Event){
            z=z+1
    }

Is this possible? Any help would be appreciated.