Apr 22 2010
uiImage: Loading Resources From Foreign Domains
The uiImage component is used to display an image (JPG/PNG/GIF). The path to the image is specified by the source property. By default, the uiImage object will attempt to load resources from the “assets/images/” folder (path is relative to the application SWF). To load from a different path, for example the folder “resources/images/”, prefix the source with “url:”, example “url:resources/images/garden.jpg”.
In order to load images from a different domain, the Flash Player will need to read a crossdomain.xml file from the foreign domain (and this file must grant permission to your domain to access the required resources). Typically, you would expect to need to specify a checkPolicyFile property somewhere. In the case of the uiImage component, there is no checkPolicyFile property to set because this would be unnecessary.
In order to load an image from a foreign domain, you would specify the source with a “url:http://” prefix. This prefix is sufficient to let the component know that you are loading from a foreign domain (you would omit the http:// otherwise).
Internally, the uiImage component sets the checkPolicyFile property automatically, as necessary. The rationale here is that, since the flag must always be TRUE for Flash applications deployed over the web (sandboxType is Security.REMOTE) whenever the Flash Player attempts to load resources from foreign domains, we might as well have the component set this automatically rather than having to expose a superfluous API. To be very clear, the checkPolicyFile flag is FALSE by default – the policy file is checked only if the application is deployed over the web (ie application’s sandboxType is Security.REMOTE), because checking the policy file is unnecessary when deployed on the desktop.








