How do reduce duplicate code?

I found myself writing this code …


 
this.onRelease = function():Void {
  delete this.onEnterFrame;
  // and a bunch of code ehre
}

this.onReleaseOutside = function():Void {
  delete this.onEnterFrame;
  // and a bunch of code ehre

}
 

See how the two functions are identical. How can I re-write this so I’m not duplicating (copying and pasting) code?