« Through the Green Fuse--Art Show | Main | Rob Simmon Joins GalaxyGoo Bloggers »

The Continuing Adventures of Flash Cross-Domain Data Loading

Back in 2002, I figured out how to integrate webMathematica and Flash. When the Flash player security tightened up with player 7, some problems came up. Even with a policy file on the remote server, the player wouldn't load the data. It couldn't find the policy file. But with the addition of loadPolicyFile(), it was possible to indicate the exact location of the file. All good.

But that solution no longer works. New problems popped up when we moved the webMathematica portion of our Periodic Table of Elements project to a new server. Data stopped loading from the remote server, and the application stalled in a "loading data" loop.

The application itself is very simple, and is an exploration of importing data from a webMathematica script into Flash. Building the table is fairly straight-forward, and a simple version of it (sans webMath calls) is in our mediaLab.

The tricky part comes in when the user clicks on an element's table cell, this triggers a call to the msp (a webMathematica script) on the remote server. Normally, a simple policy file would take care of the restrictions the Flash player has for loading remote data. However, the player looks for the policy file on the standard port.

webMathematica does not serve on the standard port. On our previous server, we found that we could work around this by using loadPolicyFile() in the swf. The port was indicated in the address: http://www.server.com:8080/somefile.msp

On the new server, the port is not part of the URL. And for some reason, loadPolicyFile() won't load the policy file we specify. Perhaps it's looking on the standard port. I tried the to-port attribute for the outgoing policy file, but this didn't help. This is where I'm stuck.

In case anyone at Adobe is reading this, and could use more details on the problem:


  • when testing in the Flash authoring environment, the remote data loads just fine.

  • we are now on port 21

  • I tried using to-port attribute in the policy file, but it didn't help


For now, as a temporary work around, Edwin has whipped up a sweet proxy-script which bypasses the whole policy file issue.

Update (question for John):
How do I load data from a remote server (through port 21 on that server) to a swf residing on my website's server (normal port)?

The remote server is running webMathematica. I've been able to load data into Flash from a remote webMathematica server before, but the remote server's port number was part of the address, using a policy file and indicating it's location with actionscript's loadPolicyFile(http://www.myserver.com:8080/math...) inside the swf.

Comments

Hi Kristin, I'm on Vicodin today and my brain is a little woozy, but I'm having trouble making an answerable question from the description... not sure where the data is actually located, what ports that server and your connection share... can't quite get to what someone else might be able to answer. Help in synthesis...?

John,

I hope you're feeling better soon.

I'm not sure if it's the Vicodin or my "prose" that's confusing :-)

Does my update to the post make more sense?

I always find anything to do with these stupid crossdomain issues in Flash so infuriating and frustrating. I really can't understand why MM/Adobe decided that crossdomain policy files were a good idea and what extra security they actually provide, especially when all you have to do to get around the problem is use simple a proxy script. It only goes to annoy developers rather provide any additional security. It's utterly bonkers.

If it's "How can Adobe Flash Player 8 be instructed to find cross-domain policy files on ports other than 80?" then I got a bunch of hits when searching on term "'flash player' security 'policy file' 'port 80'". I'm not certain whether these have been used yet, but am also not certain I searched the desired version or had the right question...?

The following LiveDocs page seems to address the desired issue, and I see no "it dont work" comments at the bottom of the page... does this page have useful descriptions?
http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002649.html

Hi Paul, yep, policy files give me a headache. Never tried the proxy script before, but now that I see how easy it is to go around the policy restrictions, those restrictions seem mostly annoying.

Hi John, I guess I am a bit shy about posting on the Live Docs, but that solution has not worked. Not working with a socket server, and the to-port attribute, wich I have tried, has not helped.

It would be helpful if I could specify the port number along with the specific URL of my policy file with loadPolicyFile()

I think perhaps my success with the old server was a fluke, because the old configuration indicated the port number in the address.

Also, the new port number is way below 1024, although I thought that wasn't a restriction anymore.

It's all very frustrating.

Sorry, I'm still not sure what to search for, what I might ask other people... I could tell them "go read all those paragraphs" but I usually get better results if I ask them an answerable question, and I'm not sure yet exactly what I should ask.... :(

Hi John,

Do you need more, or less, info that the last two paragraphs of the updated post?

Thanks!