I have created a SWF which loads an XML file and calls a function on the onload event, which in turn calls another function. This works fine. I then load this SWF into a parent SWF into Level 1 (or higher) or a movie clip. It no longer works (it does work on level 0) because the 2nd function can not be accessed.

I have reduced the code to a quick example:

The “child” SWF: (action script in frame 1)

XMLData = new XML();
XMLData.onLoad = function1;
XMLData.load("SimpleXMLData.xml");

function function1() {
trace("Inside function 1")
num = 4
trace("Inside function 1 before call : num - " + num)
num = function2(num)
trace("Inside function 1 after call : num - " + num)
}

function function2(num) {
trace("Inside function 2: num - " + num)
return num + 1
}


The “parent” SWF: (action script in frame 1)

loadMovieNum ("Child.swf", 1);
or loadMovie ("Child.swf", "_root.EmptyMC"); both fail, but

loadMovieNum ("Child.swf", 0); works

I don't think the XML file matters, but here it is anyway:

SimpleXMLData.xml
<news>
<article>Space Shuttle lifts off</article>
<article>Flash is the best</article>
</news>

Any ideas would be appreciated. I hope I am just missing something, but maybe this just isn't doable.

Thanks