views:

31

answers:

1

I have a flash player with an external javascript interface: reloadData() I'm calling that function via Javascript when editing information on the page - basically to keep data on the page and in the player in synch.

The reloadData() function works fine when the player is hosted locally. When we move it to the CDN (Amazon Cloudfront), the player loads successfully, but the external javascript interface no longer works - console.log(player) reveals the following:

<object type=​"application/​x-shockwave-flash" data=​"[our_cloudfront_url].swf" width=​"920" height=​"404" id=​"player" style=​"visibility:​ visible;​ ">​

Uncaught TypeError: Object #<an HTMLObjectElement> has no method 'reloadData'

I know there are a lot of things that behave differently when working with items on a CDN, but I'm wondering if anyone has experienced a similar problem and figured out a fix.

Oh, yeah...we're using a CNAME to point to the cloudfront distribution (buildid.ourdomain.net => distributionid.cloudfront.net)

A: 

Well, we figured this one out. Two things are necessary:

  1. On the page when embedding the swf: allowScriptAccess="always"

  2. In the swf itself: System.security.allowDomain("ourdomain.com")

I guess this is sort of obvious, but I figured I'd post it here in case some other poor lost soul such as myself is having the same problem.

byron