Help with Function and EnterFrame

Hello,

I have an enterFrame action that I use on a graphic:


    onClipEvent (enterFrame) {
        
            
        if (this._alpha >= 0) {
            this._alpha -= 2;
                } else {
            this._alpha = 0;
                }
                        
}

Because I want to use the above code more than a few times, I tried to make it a function.


function fadeOut() {  

 onClipEvent (enterFrame) {

        
            
        if (this._alpha >= 0) {
            this._alpha -= 2;
                } else {
            this._alpha = 0;
                }
}


But for some reason the function call does not work when I call it via an action on a graphic where initially the code worked when it was explicitly written and not called as a function.



onClipEvent (enterFrame) {
fadeOut();

}

What am I doing wrong?
Any help would be greatly appreciated.