Firstly, you should know that there is no exact answer to your question, since it depends on your loaded SWF (whether you know it or not, its display list ...), but I will give a simple example to explain things and you have to adapt him to his cause.
In this example, let's say that we have a very simple SWF (loaded SWF) that contains a TextField (called txt_url ) and a button (MovieClip called btn_go ).
The btn_go button will open the URL entered in txt_url TextField.
For our second SWF (loader), we will use the Loader object to load our first (which in this case will be Loader.content ), and then we will set the URL ( txt_url text) and trigger the click event on the btn_go button.
So, here is the sample code for our loader.swf :
var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, on_SWFLoad); loader.load(new URLRequest('loaded.swf')); addChild(loader); function on_SWFLoad(e:Event): void {
This example will directly set and open the URL in the browser after loading SWF, of course, we can perform this action after clicking a button or something else, but this is just a simple example to show you how you can do this .. .
Now the problem is that we donโt know anything about loaded SWF and its children (names, depths, etc.), in this case we have to do more efforts to do what we want: we have to go through the whole displayed A list of loaded SWFs to identify targets.
Returning to our example and say that we only know that at the stage there is a TextField and a button, so our code may be like this, for example:
function on_SWFLoad(e:Event): void { var loaded_swf:DisplayObjectContainer = DisplayObjectContainer(loader.content); var num_children:int = loaded_swf.numChildren; for(var i:int = 0; i < num_children; i++) { var child:DisplayObject = loaded_swf.getChildAt(i); if(child is TextField) { trace(child.name);
Again, this is a very simple example to show how we can continue ...
...
Then about passing values โโ(params) between SWFs, look at my answer to this question where you have a small example for this.
Read more about Programming display (display list, display object, display object container ...) here .
Hope this helps.