Three easy ways to approach this:
(1) - change the direction of the team. That is, in the parent SWF, you have:
projectType = "x"; loadMovie("foo1.swf", placeToShowSwf);
And this SWF file (downloaded) has:
openProject( _parent.projectType );
You get the idea. This will not work if the child SWF is loaded from another server, unless you specify problems with cross-domain scripts.
(2) - wait for the MC to load. Unfortunately, AS2 does not have built-in load events that you can use, so a common method is to use onEnterFrame as follows:
someMovieClip.onEnterFrame = function() { if ( path_to.placeToShowSwf.openProject ) { path_to.placeToShowSwf.openProject(x); this.onEnterFrame = null; } }
This will be if you want to call the method as soon as it is available; if you want to wait until the child swf is fully loaded, you want to check the SWF getBytesLoaded() and getBytesTotal() methods for children.
(3) Use a component like MovieClipLoader to complete the download - just follow the docs . Below the surface, this is similar to (2), but the details are tidied up inside the MovieClipLoader class.
source share