So further testing showed the parent SWF can access ordinary variables and
functions in the cross-domain child's SWF no problem...

The problems I ran into earlier were due to the fact that I was attempting
to have the parent SWF read directly from / write to a dynamic text field in
the child SWF so I could make visual observations and was not testing
regular vars and functions -- this is what I found:
- The parent SWF can obtain the child SWF's textfield itself (i.e.
_level0.childLoader.textFieldInstance)
- The parent SWF can obtain the text field's _name property.
- But the parent SWF cannot obtain the text field's text property....it just
always returns undefined. Why this is I have no idea, but at least for this
test it's a simple workaround to have a function in the child that can
return the text field's text.

So the takeaway is that cross domain accessing of variables and functions
works (as long as System.security.allowDomain() is in the loadee), but
accessing textfields needs wrapper functions.

~Ricky
http://codingjourney.blogspot.com


On Wed, Dec 10, 2008 at 3:12 PM, Ricky Blaha <ricky.bl...@gmail.com> wrote:

> *Background:*
> SWF #1 is published for Flash 8 / AS2 on domain name #1 and loads in SWF #2
> (same publish settings) from domain #2. Both SWFs are created using Flash
> CS4 (I need to stick with these publish settings for this project) and I
> have tested this using Flash Player 9 and 10.
>
> SWF #1 needs to load SWF #2 as a child movieclip, then at any point after
> load, SWF #1 should be able to read variables from SWF #2. (Eventually it
> will need to work both ways.)
>
> I ensured that I can at least do a simple cross-domain data load using
> LoadVars in SWF #1 and a cross domain policy file on domain #2 - that works
> perfectly.
>
> *Problem:
> *SWF #1 loads SWF #2 no problem, but SWF #1 cannot read any variables from
> SWF #2 long after loading has completed -- every variable is always
> undefined. But when testing within the Flash IDE it works fine. Sounds easy
> enough as these posts describe the simple solution to this security
> restriction:
>
> http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001083.html
>
> http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001082.html#wp238823
>
> But whether SWF #2 contains System.security.allowDomain("*"), or
> System.security.allowDomain("<domain #1 here>"), or
> System.security.allowDomain(_parent._url), or even if I attempt to set up a
> LocalConnection in SWF #2 whose allowDomain handler always returns
> true.....none of these work.
>
>
> I could post code samples but they no different than the examples in those
> two links. Can anyone else get this simple setup to work correctly?
>
> Thanks!
> RB
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to