user1248384
user1248384

Reputation: 1

External images not smooth in BitmapImage as3

What I'm doing

Hello Im having problems loading external images into my flash (builder) application. To show the image I use a BitmapImage with smoothing enabled like this:

<s:BitmapImage id="image" smooth="true" smoothingQuality="high" width="100%" height="100%" fillMode="clip" />

I also show thumbnails using the new flex4.6 scaleMode ZOOM like this:

<s:Image id="thumbnail" scaleMode="zoom" smooth="true" smoothingQuality="default" />

I preload the external image using a SWFLoader because I need to store the original image width and height

The problem

When I test my application locally everything works fine! But when I run it from my web domain I see its showing problems. For images running on the same domain and images from Flickr = no problem. But other images like from imageshack show the following problems:

Cause?

Im not really sure whats causing the problem, but the only difference I see in the image sources is in the domain policy. The crossdomain.xml for Flickr allows all http://farm1.static.flickr.com/crossdomain.xml unlike imageshack.us http://www.imageshack.us/crossdomain.xml

If this would be the cause then I dont understand why the image is still being loaded but crappy. Does anybody know what's going on exactly? Any solutions? Thnx.

Upvotes: 0

Views: 634

Answers (1)

James Tomasino
James Tomasino

Reputation: 3581

There are certain limitation to loading images cross domain without the correct policy enabled. Flash will load the data, but not allow any manipulation, including smoothing.

There are a number of ways around this. You could use a server-side proxy, loading the image via a local php or asp page. It's not the fastest solution, but it will work.

You could also try loading the image with LoadBytes, then passing the byte-array into a Loader object. It's not as pretty as using the Flex component, but it should restore some control to you.

Upvotes: 2

Related Questions