ExternalInterface is a good approach.
Perhaps better yet would be the LocalConnection class:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/LocalConnection.html
Maybe a good start to understand basic concepts is from this answer provided here at Stack Overflow:
How to pass a String from a SWF into another SWF
Answered by Plastic Sturgeon:
Let's clarify a bit: 1. The loader swf, we will call the parent. 2.
The swf loaded by the parent we will call the child.
The Child contains a string, and you want the parent to be able to
read that string> So... The Child must define a public variable for
the string. (This means you have to use a Class file for it, since you
cannot declare a property public on the timeline.)
Finally, the parent will try and get that property. You may want to
wrap that in a try/catch to handle cases where the string will not be
present.
Here is an example Child Class.
package
{
import flash.display.Sprite;
/**
* ...
* @author Zach Foley
*/
public class Child extends Sprite
{
public var value:String = "This is the child Value";
public function Child()
{
trace("Child Loaded");
}
}
}
And here is the parent loader class:
package
{
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
/**
* ...
* @author Zach Foley
*/
public class Parent extends Sprite
{
private var loader:Loader;
public function Parent()
{
trace("PArent Init");
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
loader.load(new URLRequest("child.swf"));
}
private function onLoaded(e:Event):void
{
trace("Child Loaded");
trace(loader.content['value']);
}
}
}
The Output will be: PArent Init Child Loaded Child Loaded This is the
child Value