Using cross-domain.xml with Flex application

Hi All,

Sometime we face issues while accessing .SWF/Flash files from remote domains. Sometime you will see few blogs asking us to change the browser settings.  But there is a workaround provided in Flex, There is ae Security class object which lets you specify how content in different domains can communicate with each other.

There are two main methods which we can use for this purpose.

1. Security.allowDomain(“*”)
2. Security.allowInsecureDomain(“<DOMAIN_NAME>”);

NOTE: Use allowInsecureDomain() only to enable scripting from non-HTTPS files to HTTPS files.

OR

Second alternative is to use Cross-domain.xml

Crossdomain basically allows you to connect between servers (i.e. load in external files from external URLs/domains) pretty handy when you need information sitting on external servers.

<cross-domain-policy>
<allow-access-from domain=”*” to-ports=”507″ />
<allow-access-from domain=”*.foo.com” to-ports=”507,516″ />
<allow-access-from domain=”*.bar.com” to-ports=”516-523″ />
<allow-access-from domain=”www.foo.com” to-ports=”507,516-523″ />
<allow-access-from domain=”www.bar.com” to-ports=”*” />
</cross-domain-policy>

If you are hosting you application on Tomcat, put the crossdomain.xml in root application folder.
e.g.
<<Tomcat 6.0>>\webapps\ROOT\cross-domain.xml
[Complete-Source] http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/system/Security.html#allowInsecureDomain%28%29


Thanks
R Vashi.

One thought on “Using cross-domain.xml with Flex application

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s