[AS3] - Send a string value to an external SWF while loading it - possible or not?

D.

So many deferential opinion and option, no wonder buyer struggle :stuck_out_tongue:

I donā€™t have advice for you since I donā€™t know whats the big picture is, look like a template to me.
I usually build a class path manger that handles all this so i donā€™t need to go and wonder on my class.

Just find your own way to do it and strip your code to basic and start again. I am a big fan of logic, the more string value you have on the extended class itā€™s harder(remember) to track things

^

Very well said, Tsafi, as a matter of fact I decided to start it all over again and found that the best way of achieving the desired result was to follow Steveā€™s advice. All that and an extra Signals flavor :slight_smile:

Thanks for your help, guys! !http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/79.gif! Dunno what Iā€™d do without you! :slight_smile:

Hey DaniMun I found your post because I was looking for a similar solutionā€¦ to the other devs, yes it is easier to just pass it in the URL, but one reason to pass a SWF could be to attach analytics inside of it :slight_smile:

Anyways Dani I posted my question here and it got answered with great working code:

DaniMun said

Hey guys, was wondering if thatā€™s doable - basically I have main.SWF into which Iā€™m loading external.SWF and would need to pass the path to an XML file to external.SWF, so that external.SWF knows which XML to use.

/** code in main.SWF **/

import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;

var ldr:Loader = new Loader();
var externalFullPath:String = "external.swf?xmlFile=different.xml";//here I'm specifying the path to the SWF file along with the XML that it should use
var rq:URLRequest = new URLRequest(externalFullPath);
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
ldr.load(rq);

function done(e:Event):void
{
	addChild(e.target.content);
}

Would that be achievable?

Thanks! :slight_smile:

Add an event dispatcher to the main SWF after, and an event handler to the external SWF.

Thereā€™s an example here:

http://www.xllusion.net/ed/2008/01/21/as3-custom-event-for-passing-unlimited-parameters/