Hey all,

I've been trying to get a system up and running where one main MovieClip is capable of loading and unloading a couple dozen smaller MovieClips. Problem is, although I can get the main MovieClip to load the others in, I can't seem to access the functions that are normally available to them.

The main MovieClip is doing something like:

Actionscript Code:
function LoadTestMovie(Void) :Void
{
     loadMovie("OtherMovieClip.swf", _root.MovieClipToOverride);
     
     _root.MovieClipToOverride.SetText("Hello world!");
}

_root.MovieClipToOverride is just a blank movieclip I've placed on the main timeline. I've also tried doing this by using 'createEmptyMovieClip' to create a new movie and by using the MovieClipLoader class.

OtherMovieClip.swf is a simple movieclip with a text field placed on the main time line. There's no actionscript on the timeline though, it's all in an external script file. I'm linking the actionscript to the MovieClip using the linkage options.

Actionscript Code:
class Scripts.OtherMovieClip extends MovieClip
{
    private var m_tfText:TextField;

    public function OtherMovieClip()
    {
        m_tfText = eval(this + ".Text");
    }

    public function SetText(strNewText:String) :Void
    {
        m_tfText.text = strNewText;
    }
}

So I can load 'OtherMovieClip.swf' into the main MovieClip, but I can't access the 'SetText' function once it's loaded.

I thought it might be an issue with 'OtherMovieClip' not being loaded when the SetText function is called, and tried spamming it each time 'onEnterFrame' is executed, but this didn't help either.

It should be noted I've also managed to get this working by importing the source assets into the main movie's library, but I'd prefer to avoid this at all costs. Ideally I want a small library of small .swf files that can be updated independently.

Any ideas? Is there a better way of doing this?

- Phil