Movie Clip functions

Hi,

I am having a problem defining a function for a movie clip in the main time line.

I am using the following function:

myClip.onRollOver = function() {
if (_global.unitMenuClicked == 1) {
myClip.gotoAndStop(10);
} else {
myClip.gotoAndPlay(1);
}
}

If I put this definition in frame 1 of the main time line and myClip is on the stage in frame 1, everything works fine.

If I put this definition in frame 1 of main and myClip is on the stage in frame 1 and remains on stage until, say, frame 4: everything works fine.

If I put this definition in frame 1 of main while myClip is NOT on the stage in frame 1 but then appears on the stage in frame 4, it does not work!!

If I put this definition in frame 1 of main while myClip IS in frame 1, NOT in frames 2 and 3, and IS in frame 4, it does not work!!

I want to be able to define a mouse handling function for a movie clip in frame 1 of main timeline that handles events of a clip that appears in frame 4 (or anywhere else for that matter)

Is this possible?

Cheers,

Jay

Perhaps my question is: “What is going on here?” Why is this happening? (ok that’s 2 questions)

I really want to understand the mechanics of this.

Thanks