Function call problem

Hi,
I get a problem when I call a function in a movie clip.
I place a movie clip named “aMC” in the first frame of the root timeline. Inside the movie clip, there is a function call testFunc(). I add some action script in the first frame of the root timeline.
That action script is:

_root.aMC.testFunc();

I suppose it can call the function inside the movie clip, but I fail to do this. I also try to place a button in the first frame of root timeline and add the code in the button:

on(release)
{
    _root.aMC.testFunc();
}

It can call the funtion successfully.
Someone may ask this question before, but I really confuse about this. Hope someone can help me.

Sounds dodgy. Have you tried just

[COLOR=blue]testFunc();[/COLOR]?

I had a similar problem in a game. I used just the function name and it worked.

Hope it helps…

Hi,

Why don’t u bring the function to the main timeline?
This way u don’t only avoid this problem but have all the code neatly in the same place.

Cya

SHO

Yeah, put your function in the _root and call it with _root.myFunc().

You can also make it global, but the _root will do.

pom :slight_smile:

the problem with your function, I believe, is that you’re calling the function before the movie declares it. Know what I mean? Also, you’re not pointing to the function inside the movie. So, for example, if you had three movies with the same function defined… which movie would you be calling?

I agree Iammontoya said that I called the function before the movie declares. Then, is there any method or trick, so that I can call this kind of function inside a movie clip?