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

can't access the .parent properties of the Loader with player 11.2

Participant ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

ok, this is so embaresing and my whole business is suffering from this! www.doitflash.com

the key point in my TextArea class which extends TextField is to load external swf files and I use the .parent property of the Loader class to access the textfield... with the new security updates coming with 11.2 I cannot access the parent and the whole thing crashes!

to give you more insight:

imagine that we have file.swf being loaded into the project using the flash.display.Loader class.

from the document class of file.swf, I can access the loader like this, all ok till here

_loader = this.parent as Loader

I used to access the TextField like this:

_textArea = _loader.parent as Object

now this does not work!!!

I would appriciate any idea on how I can fix this...? every day that one of my clients updates their player to the new version, their website fails. I need to fix this a.s.a.p. Thanks.

TOPICS
ActionScript

Views

921

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

correct answers 1 Correct answer

Participant , Apr 18, 2012 Apr 18, 2012

I found a work around the problem... I'l explain here so anyone having the same problem can fix this...

ok, I have a String with < img tags in it where they loaded the external swf files. the problem was that the loaded swf file could not have access to the main project which had loaded it through TextField. so what I did was to parse the String and locate all the < img tags and add the id="sth" attribute to them, at the same time, I saved an array of these id attributes.

now I was able to listen

...

Votes

Translate

Translate
Advocate ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

you just get a crash? no errors? nothing traced out?

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
Advocate ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

also maybe try watching this thread

http://www.actionscript.org/forums/showthread.php3?t=272296

although it's 3 days old now so might be a deadend

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
Participant ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

that's the exact problem I have also... http://www.actionscript.org/forums/showthread.php3?t=272296

as suggested there, I also installed the debugger version of 11.2 and yes, the debugger tells me that _loader.parent is null and I can't access it

I hope it's not a deadend! I have to find a way soon anyway!

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
Participant ,
Apr 18, 2012 Apr 18, 2012

Copy link to clipboard

Copied

LATEST

I found a work around the problem... I'l explain here so anyone having the same problem can fix this...

ok, I have a String with < img tags in it where they loaded the external swf files. the problem was that the loaded swf file could not have access to the main project which had loaded it through TextField. so what I did was to parse the String and locate all the < img tags and add the id="sth" attribute to them, at the same time, I saved an array of these id attributes.

now I was able to listen to the Loader of these external SWF files to see when they are finished loading:

<pre>

var loader:Loader = textField.getImageReference($id) as Loader;

loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onModuleLoadDone, false, 0, true);

</pre>

then, I created a function called "construct" in the external swf files and now I can call that func and pass a reference to the TextField to that external swf

<pre>

private function onModuleLoadDone(e:Event):void

{

     var content:* = e.currentTarget.content;

     content.construct(textField);

}

</pre>

it now works fine. Adobe, you almost gave me an heart attack! but thanks for all your works. After I made this update in my projects, I feel like it is the better approach I should had thought of to begin with. it's more secure now and it makes sure non allowed external swf files won't be able to run func in the main project...

Hadi

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