Copy link to clipboard
Copied
Hi. please help me. I have a AS2 program called Main.swf. It loads another(not mine) program (call it Base.swf). Both of these files are located locally on my computer. I load into my program Mine.swf an external file load.swf.
//Main.swf
System.security.allowDomain('*');
this.createEmptyMovieClip('module', 0);
module.loadMovie('http://192.168.10.102/loaded.swf');
From the loaded.swf file, I try to access _root which should be equal to Base.swf. But I can not do it. Although from the file Main.swf I can access _root.
//Main.swf
...
_root.someFunctionFromBase(); //it work
module._root.someFunctionFromBase(); //even so works
//loaded.swf
_root.someFunctionFromBase(); //undefined
How can I access variables and functions in _root from the loaded file?
Copy link to clipboard
Copied
Main loads loaded and Main loads Base?
Copy link to clipboard
Copied
Sorry, probably not correctly explained. The sequence is as follows: Base <- Main <- loaded
Copy link to clipboard
Copied
if you want to reference objects in Main from loaded, use _parent.
Copy link to clipboard
Copied
no. I want to refer to objects in Base.swf from a loaded.swf
Copy link to clipboard
Copied
use _parent._parent
Copy link to clipboard
Copied
this does not work. Files Main.swf and Base.swf - local, and loaded.swf - remote. If I load a loaded.swf from the local, everything works. But if I load the file from the http server - I can not access _root. That is the problem.
Copy link to clipboard
Copied
then you probably have a timing issue. _parent._parent is the correct path if you explained the loading correctly.
Copy link to clipboard
Copied
It seems to me that the problem is with some limitations of security. Because the problem only occurs when load file from a remote location. I repeat that when I load file from a local location(from the same directory where Main.swf is located), I can access _root, _parent._parent, etc.
Copy link to clipboard
Copied
or timing.
Copy link to clipboard
Copied
This is not a timing. I see when the loaded.swf is added to the Main and only after that I try access to _root. I'm sure that at this point in time the file is already loaded.
Copy link to clipboard
Copied
what's the url to Base?
Copy link to clipboard
Copied
Base.swf and Main.swf are local files. They are located on my computer. And loaded.swf it remote file, located on my web server. I will try to explain in more detail: Base.swf is the main application (it is quite large and complex). Main.swf is simply a loader that loads an external file (loaded.swf) as a plug-in that will later work with objects and functions of Base.swf. But if I load a loaded.swf from a web server, and not from a local location, then I can not access _root from it. Sorry for my bad english =(
Copy link to clipboard
Copied
that is a security issue.
check the Security class'es allowDomain() method.
Copy link to clipboard
Copied
I have already tried everything that is possible with a security class. I guess that the problem is with security, but I can not understand what exactly will solve this problem.