actionscript 3 - How to pass arguments to constructor if object is loaded dynamically with Loader in flash? -
is possible ? if yes how ?
otherwise what's alternatives ?
by dynamically mean using
loader = new loader(); loader.contentloaderinfo.addeventlistener(event.complete, finishloading); loader.load(new urlrequest("myswf.swf"));
a swf not class itself, more collection of classes , other things (like images or audio bytes) archived , ready use. can't have constructor swf. however, can do, loading swf , then, after loading complete, can instantiate class swf , pass whatever arguments want it's constructor.
also, it's possible send parameters swf , process them flashvars inside swf, that's no constructor of course :)
loader.load(new urlrequest("myswf.swf?day=tue&week=3")); and can them this:
var paramobj:object = loaderinfo(this.root.loaderinfo).parameters; trace(paramobj.day); trace(paramobj.week);
Comments
Post a Comment