Event handling question

I have a movie and there is a key event listener on the main time line. There is another movie clip that has a key event processor. What I am trying to achieve here is, when the movie clip is not attached, the keyborad controls the movement of the object on the main stage. But when the movie clip is attached, the up, down, left, right control the movement of the ball in the movie clip. Later, when the movie clip is removed, the direction keys go back to control the movement of the object in the main line.

I am not sure whether this make sence.

Thanks