Calling a function within a movie clip

On my main timeline, I have a movie clip located on frame 3. Inside that movie clip I have a function. My goal is to call that function from frame 1 of my main timeline.

I have tried the following code with absolutely no results:


I’ve also tried:


Any suggestions?

I could be wrong here… but your function will only exist on the “on handler”.

Why not create your function in a frame of the main timeline? That way it will always be available to all objects in your scene.

It actually gets kind of complicated, but basically it needs to stay in my movie clip because as part of my function I am evaluating a variable and then moving on to a different frame in the movie clip.

But what did you mean by it only existing on the “on handler?”

I can easily jump from somewhere in a movie clip to function on my main timeline, and according to everything I’ve read, I should be able to jump from my main timeline to a function in a movie clip. I just can’t seem to determine what is going wrong.

I welcome any suggestions.

I may not be right either… but as far as I know… you can only do this if the movie clip that contains the function is in existence when you attempt to call the function.

Exactly, Upu. You can’t do that because the function dosn’t exist at the time you’re trying to use it. But what you can do though is define a prototype in frame 1 and then call it. Or even a function that you can call with _root.function.

pom 0]