0

I have an swf file (swf2) that loads into my main swf file (swf1). On the click of a button (which is housed in the loaded swf file swf2) I need to stop swf2 from running and load on new swf (swf3).

I am using removeChild(loader);

But the problem is loader in in the parent (swf1) swf, how do I reference it?

Sorry if this is not enough info, I am not really an expert here.

Thanks

Jane Wood
  • 11
  • 3

1 Answers1

0

The way I understand this is that you have swf1 loading swf2. Swf2 contains a button that when pressed, causes swf1 to unload swf2 and load swf3.

There are a few ways to do communicate between loaded swfs and their parents. One way (the method I usually use depending on context) is that you could have the loaded swf throw an event that the parent can listen to and catch. In this case, your loaded swf2 could throw a "close" event the parent swf1can catch and then use to trigger the unloading of the swf2 (and load the swf3).

For another way, check to see if you can access the parent (which would be the main loading swf, swf1) inside the loaded child swf by it's parent property. I can't always recommend this though as it can be unclear to what 'parent' may refer to in the future if you reuse swf2 with another loader.

Something else to consider though, if this button is meant to control loading and unloading of children swfs, would it make more sense to move it out to the loader itself since that is where the behaviour is? This would also eliminate the problem.

mitim
  • 3,169
  • 5
  • 21
  • 25