tags:

views:

129

answers:

4

Hey guys,

In my Flex 4 app, I access an RSS feed (I'm using http://news.ycombinator.com/rss as a dummy). It works okay when I run it from Flash Builder 4, but if I export the project and upload it, I get the following error when it tries to load the RSS feed:

Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: my_website_url cannot load data from http://news.ycombinator.com/rss.

What could be causing this error? Shouldn't RSS be able to be accessed from anywhere? Thanks for reading.

+1  A: 

Afaik flash looks for a crossdomain.xml (http://news.ycombinator.com/crossdomain.xml) file to detect if it's allowed to download this content. You find a possible solution here.

aeby
Ah ok. I knew about crossdomain.xml, but (stupidly) assumed that RSS feeds would be setup to allow access. I should have checked! The link you provided looks promising, I'll try it out. Thanks for your help.
ben
+1  A: 

The Flash Player is in it's own security sandbox inside the browser. It cannot access URLs outside the domain from which it was served unless it is given permission.

That permission is given through the use of a crossdomain.xml file. There is no cross domain file on the ycombinator site, as you can see here: http://news.ycombinator.com/crossdomain.xml . As such flash will not be able to access that URL unless the swf file is also served off ycombinator.

I'm unclear why this works when you test it locally; you should be having the same issue.

If that is your site, you can create a cross domain file and add it to the root directory and your problems should go away. More info here:

http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html

If you need an alternate feed to test with, you can use The Flex Show's RSS:

http://www.theflexshow.com/blog/rss.cfm?mode=full

(our Cross Domain for your reference)

http://www.theflexshow.com/crossdomain.xml

www.Flextras.com
A: 

"I'm unclear why this works when you test it locally; you should be having the same issue."

This is because when you are running from Flash Builder, the output file is a local file and hence the security domain is different as opposed to a SWF hosted in a web browser.

Victor

George Victor
A: 

Sorry, A typo:

.... as opposed to a SWF hosted in a web SERVER

George Victor