Help with script

hi ive got an object and i want to make it change color to black when i press the space key. but i want to do it as an “”=function() {} the code i have is not working can anyone help me please
heres my code:

onClipEvent (enterFrame) {
var co = new Color(this);
Key.SPACE.onKeyDown = function() {

any help would be appreciated.