How to make external swf buttons effect root swf

Your help would be greatly appreciated:

When I load an external swf, how do I make it so a command effects the main swf? For example, when external.swf is finished playing, how do I make it so main.swf goes to the next scene? (In my case the external swfs are random, and not of a uniform length, so it is necessary that external.swf tells main.swf when it is done playing.)

Is there any way I can do this? I’d even prefer it if this action was automatic, without a button.

Thanks for your time.