R – childAllowsParent

actionscript-3apache-flex

A simple question, really – but one I've been beating my head against the wall for hours and hours trying to solve:

How do you make the childAllowsParent property of an SwfLoader go from false to true, that is, how as a parent application do you set up security to make the child app's events and other properties accessible to you.

To read the flex docs on this, one would think nothing could be simpler:

"This property [childAllowsParent] is set to true if the child object has called the allowDomain() method to grant permission to the parent domain or if a URL policy is loaded at the child domain that grants permission to the parent domain. If child and parent are in the same domain, this property is set to true . [emphasis added]"

So, I'm in a development environment and want to load an swf from my own system via an SWFLoader and then be able to monitor its events within the parent app.

I started by setting trustContent to true in the SWFLoader, but childAllowsParent is still false. I then set up a user flashplayer trust file specifying the directory the swf's are in (child and parent). But childAllowsParent still false. I then inferred from some of the things I read that you actually have to access the parent app and child app from an http server, so I set up xampp on my system, and then accessed the parent app via http://localhost (through the html file the parent app is referenced in). No luck- childAllowsParent is still false. I then put a crossdomain.xml policy in the root directory of my html server (specifying allow-access-from domain="*"). childAllowsParent still false.

I then went back to my flex code and set loadForCompatibility in the SWFLoader to true. (starting to grasp at straws I guess.) childAllowsParent still false. Then I switched the 'use-network' command line param in mxmlc from false to true. childAllowsParent still false. I've gone back and reset all the previous to their original values and then started trying them in various different permutations but childAllowsParent is always false.

So basically, I know I've seen plenty of documentation on line of people accessing the attributes of a child app loaded via an SWFLoader. So do they all understand the arcane alchemy that is Flash security, or did they just get lucky.

What do I have to do to access the events of a child app loaded via SWFLoader.

Best Answer

I do have an application_complete handler, but it looks like the application wasn't loaded yet when I was checking childAllowsParent. (I thought it would be long after it was loaded.) So anyway, if that's all it was nevermind and I apologize.

Related Topic