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

access to _root from remote loaded swf

Guest
Apr 11, 2017 Apr 11, 2017

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?

TOPICS
ActionScript

Views

882

Translate

Translate

Report

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

Copy link to clipboard

Copied

Main loads loaded and Main loads Base?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

use _parent._parent

Votes

Translate

Translate

Report

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

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

or timing.

Votes

Translate

Translate

Report

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

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

what's the url to Base?

Votes

Translate

Translate

Report

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

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

that is a security issue.

check the Security class'es allowDomain() method.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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