I need to load an image from flickr into my application. Do I need a crossdomain.xml file on flickr?

When we load images at run time, we should be aware of the security restrictions of Flash Player. For example, we can reference an image by using a URL, but the default security settings only permit Flex applications to access resources stored on the same domain as our application. To access images on other servers, we must use a crossdomain.xml file.
Every SWF file we view runs locally on our machine. This means that a SWF would have HTTP access to all machines behind the company firewall. To prevent this, every server other than the one the SWF is loaded from, needs to have a crossdomain.xml file in its root, listing all domains that have access to that particular server.
NOTE
We can use relative URLs for images hosted on the same web server as the Flex application, but we must load these images over the Internet rather than access them locally.

Loading Remote Style Sheets
If the style sheet is local(from the same domain as the loading application), we can load it without any additional settings. If the location of the style sheet is remote (in any domain that is not an exact match of the loading application’s domain), we must set the third parameter of the loadStyleDeclarations() method, trustContent, to true. Loading remote style sheets does not require a crossdomain.xml file that gives the loading application permission to load the SWF file.

StyleManager.loadStyleDeclarations("assets/ButtonStyles.swf", true, false)

Also, to use remote style sheets, we must compile the loading application with network access (have the use-network compiler property set to true, the default). If we compile and run the application on a local file system, we might not be able to load a remotely accessible SWF file.
The loadStyleDeclarations() method returns an instance of the IEventDispatcher class.
We can use this object to trigger events based on the success of the style sheet’s loading. We have access to the StyleEvent.PROGRESS, StyleEvent.COMPLETE, and StyleEvent.ERROR events of the loading process.

We can unload a style sheet that we loaded at run time. We do this by using the
StyleManager’s unloadStyleDeclarations() method. The result of this method is that all
style properties set by the specified style SWF files are returned to their defaults.

StyleManager.unloadStyleDeclarations("assets/ButtonStyles.swf", true);

No comments:

Post a Comment