accessing a variable in a parent SWF
Hello!
I have an SWF file that loads another SWF file dynamically.
I've managed to make the parent SWF receive a variable from the php page that loads it, via javascript, it works well:
Code:
try {
var keyStr:String;
var valueStr:String;
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
for (keyStr in paramObj) {
valueStr = String(paramObj[keyStr]);
}
} catch (error:Error) {
}
But then I want the nested SWF to access this variable and then do some function.
in this case, the nested swf has a line
the nested swf should be able to receive a number, and pass to a function that would load its respective image from an array. otherwise (if it doesn't receive a number ) it won't do nothing (load no image).
that worked well too, as I tested by manually substituing the number -1 in the statement above with a positive number, inside the flash interface.
Now what should be the simplest part of it (at least in my imagination) is being a pain in the ***.
I've tried using the try/catch statement in the nested SWF like this:
Code:
var paramObj:Object = LoaderInfo(MovieClip(parent).loaderInfo).parameters;
or
Code:
var paramObj:Object = LoaderInfo(parent.loaderInfo).parameters;
or trying to access valueStr in the parent SWF file:
Code:
MovieClip(parent).valueStr;
and parent.valueStr;
but no success.
Please help!
Thanks in advance!