GhostWire Studios - Flash/Flex UI Components Development And Consulting Services
Quality User Interface Controls For Flash Application DevelopmentAspireUI Components

Apr 22 2010

uiImage: Loading Resources From Foreign Domains

Published by at 3:33 am under Aspire UI,Flash

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.

pixelstats trackingpixel
Be Sociable, Share!

    No responses yet

    Comments RSS

    Leave a Reply

    To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
    Click to hear an audio file of the anti-spam word