Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

access to _root from remote loaded swf

Guest
Apr 11, 2017 Apr 11, 2017

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?

TOPICS
ActionScript
955
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 14, 2017 Apr 14, 2017

Main loads loaded and Main loads Base?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 15, 2017 Apr 15, 2017

Sorry, probably not correctly explained. The sequence is as follows: Base <- Main <- loaded

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 16, 2017 Apr 16, 2017

if you want to reference objects in Main from loaded, use _parent.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 16, 2017 Apr 16, 2017

no. I want to refer to objects in Base.swf from a loaded.swf

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 16, 2017 Apr 16, 2017

use _parent._parent

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 16, 2017 Apr 16, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 16, 2017 Apr 16, 2017

then you probably have a timing issue.  _parent._parent is the correct path if you explained the loading correctly.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 16, 2017 Apr 16, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 17, 2017 Apr 17, 2017

or timing.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 17, 2017 Apr 17, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 17, 2017 Apr 17, 2017

what's the url to Base?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 17, 2017 Apr 17, 2017

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 =(

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 17, 2017 Apr 17, 2017

that is a security issue.

check the Security class'es allowDomain() method.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 17, 2017 Apr 17, 2017
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines