Attach movie clip stuff

first id like to say that i have very little idea what im talking about.

hmmmmmm… ive been having problems with my actionscripting.
i want a movieclip to be attached to another one when a key is pressed. i thought something like this would work:

onClipEvent (enterFrame) {
if (key.isdown(key.SPACE)) {
clip1.attachMovie(“clip2”, “clip2newname”, 10);
}
}

where “clip2” is the linkage identifier for the mc to be attached. the code is placed on the outside of the clip one, where i want clip2 to go.

the attachmovie method works on its own, but not with the if condition.

any help is appreciated