views:

21

answers:

1

Hi im loading a child swf into my parent swf and I want to pass some parameters to the child swf. Any idea on how to do this.

Here is my code:

var req:URLRequest = new URLRequest( "test.swf" );

var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener( Event.COMPLETE, loadComplete );
loader.load(req); 

    function loadComplete(e:Event){
  var childSwf:DisplayObject = e.target.content as DisplayObject;

      //Im guessing here I need to set the parameter 
  VideoContainer.addChild(childSwf);
    }
A: 

Yes, you can simply pass parameters to child swf url.

e.g. new URLRequest("http://abc/test.swf?param1=value1&param2=value2");

now if the test swf is as3 , you can retrieve the parameter as follows: var p1 = root.loaderInfo.parameters['param1'];

and if it is as2, simply _root.param1 would give you the value.

jash