Creating your own functions?

How would I go about making my own functions for objects and movie clips?
Like:

onClipEvent(enterFrame){
this.setpos(10, 20);
}

and…

function setpos(x, y){
_x = x;
_y = y;
}