all groups > flash (macromedia) > april 2006 >
You're in the

flash (macromedia)

group:

function problem


Re: function problem tralfaz
4/21/2006 3:33:06 PM
flash (macromedia): [quoted text, click to view]

There's nothing wrong your function call as long as the movieclip with the code in it is in scope when the code runs.
tralfaz

function problem erjee
4/21/2006 10:18:40 PM
i want to 'call' a function from the root movie to a child movie.
So in the root i have:
_root.child_mc.functionName();
in the child_mc:
functionName = function() ...

I can do the 'reverse' :
in the root:
functionName = function() ...
in the child_mc:
_parent.functionName

can someone help me ?
Re: function problem tralfaz
4/22/2006 11:25:38 AM
[quoted text, click to view]

You cannot call a movieclip's function on the first frame of the _root timeline because of the loading/playing order. Just wait 1
more frame before you call it, using either a timer or a delay or move the calling code to frame 2. If you call the function over
and over you will see that it works starting in frame 2.

this.onEnterFrame = function()
{
movie_mc.test();
}

// inside movie_mc
function test() {
trace(_root._currentframe);
}

Whenever you have problems with your Flash programs, zip the fla up, upload it to your website and post a link to it here. It's the
fastest way to get help on it.
tralfaz





Re: function problem erjee
4/22/2006 3:51:43 PM
hereby my not working code
i can not attach a fla-file so i'll try it this way
in the root of a new flash doc i wrote this code:

_root.movie_mc.test();

rootfunction = function() {
trace("call to rootfunction works");
}


i made a movieclip called movie_mc and attached this code:
function test() {
trace("it's working");
}

_parent.rootfunction();

the result is that the call to the rootfunction (from the child) works
but the call from the main or root to the child does not

:-(
Re: function problem erjee
4/26/2006 8:28:44 PM
THANK YOU !!
AddThis Social Bookmark Button