# Movie Clip functions

**URL:** <https://forum.kirupa.com/t/movie-clip-functions/21306>\
**Category:** flash\
**Created:** [May 20, 2003, 3:27am UTC](https://forum.kirupa.com/t/movie-clip-functions/21306 "2003-05-20T03:27:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JDLenner](https://avatars.discourse-cdn.com/v4/letter/j/e5b9ba/32.png) [@JDLenner](https://forum.kirupa.com/u/JDLenner)\
**Post date:** [May 20, 2003, 3:27am UTC](https://forum.kirupa.com/t/movie-clip-functions/21306/1 "2003-05-20T03:27:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2003, 3:34am UTC](https://forum.kirupa.com/t/movie-clip-functions/21306/2 "2003-05-20T03:34:24Z")

</div>

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
