How can I call a function in a parent movieclip from an externally-loaded child?

Posted by Doug Wolfgram on Stack Overflow See other posts from Stack Overflow or by Doug Wolfgram
Published on 2012-06-28T02:27:45Z Indexed on 2012/06/28 3:16 UTC
Read the original article Hit count: 157

Filed under:
|

I have a swf file that is my 'shell' program that contains many functions. This shell program loads child movies. In the root timeline of the child movie, I have the following code:

function putresponse(q,r) {
    trace (r);
    _root.debug(r);
}
_root.debug("foo");

Debug is a function that writes some text to the screen. When I run this locally, the putresponse function gets called and the trace happens. When I run it remotely (inside the shell) the first debug happens immediately on load (as you'd expect) but then later when putresponse is called, the debug(r) is not executed. The external clip is at the same url as the shell so I don't think it is a security issue. Also, as I said, the debug("foo") works fine. This one really has me perplexed. Can anyone shed some light as to why I can't call the debug from _root when called from a function rather than on the first-level timeline?

EDIT: The call to putresponse is coming form two layers deep in local (within the child MC) MCs. The actual call is:

_parent._parent.putrepsonse(q,r);

© Stack Overflow or respective owner

Related posts about flash

Related posts about actionscript-2