Fixing the Security Sandbox errors with AS3 Flickr API

One of the recent experiments I tried was with the AS3 Flickr API. Adobe Labs has published a library called as3flickrlib on Google Code which makes it easier to access your flickr photos. So I downloaded that (using the flickr-.85.zip link under the Featured Downloads section) and started playing with it. I felt it was pretty straightforward to use it, partly because I have used other Flickr libraries like Flickr.Net for the .Net framework.

When developing inside Flex Builder my code worked great and I could access images and other information through the library. But when I deployed the compiled version to my server, I started getting Error#2048: Security Sandbox violation. Cannot load resource from http://flickr.com/… I knew that this error had to do something with the crossdomain.xml policy file that must deployed on Flickr so that external access to it is allowed. When I did a Google search on “crossdomain flickr”, I did find the policy file on http://api.flickr.com/crossdomain.xml. But surprisingly the domain was api.flickr.com and not flickr.com, as it stated in my security error.

After a couple more Google searches I came upon this YahooGroups post where it said that the API end-point for Flickr has changed! AHA! This made me think that the as3flickrlib must be still using the old flickr.com endpoint. Sure enough, when I opened up the source for FlickrService.as, it was using the wrong end-point.

public class FlickrService extends URLLoaderBase { /** * The REST endpoint where we can talk with Flickr service */ public static const END_POINT:String = "http://flickr.com/services/rest/?";

To fix that, I looked at the sources for as3flickrlib on the Google Code Subversion repository. Interestingly FlickrService.as over there was using the correct end-point (api.flickr.com). So I got hold of the sources for as3flickrlib and the dependency: as3corelib, recompiled them inside Flex Builder and generated a new as3flickrlib.swc. Using that, things started working like expected.

So if any of you are using the SWC from the zip file provided on as3flickrlib Google Code project, it is NOT going to work when you deploy your application online. You can use my recompiled SWC, which I have uploaded over here. Ideally Adobe should be updating the build and uploading the new version. Right now the source in SVN and the compiled zip are not in sync :-(.

 

 

Technorati tags: , , , ,
About these ads

4 Responses to “Fixing the Security Sandbox errors with AS3 Flickr API”

  1. The FlexWinds blog Flex + Flickr + Cairngorm « Says:

    [...] problems deploying it to my server, primarily the Security Sandbox error. I did a blog post on that here. I have seen some people asking for the similar problem on FlexCoders group. Hopefully my post will [...]

  2. imtiyaz Says:

    Thanks pavan,
    I am fighting with it from last two days…
    I am succeed with your answer thank your very much.

    Regards,
    Imtiyaz.m.s

  3. Quince Says:

    I had the same issue with googleapis. I found a fix that will work for any external api. I basically made a php bridge to the api on my server. That way I was able to avoid the sadn box issue. I wrote a turtorial on it at http://peakstudios.com/fixing-flash-player-and-externa-api-sandbox-issues-using-php-as3/

    Hope this helps!

    Q

  4. changetherec Says:

    pc-config: PC, config, windows, windows 8, windows 7, windows xp, Операционная система, ос, Linux, Mac OS,
    Сетевые подключения, Wi-Fi, ADSL, Сетевые карты, Спутниковый интернет, Роутеры,, свичи, Браузеры,
    Антивирусы, Офисные, Аудио-видео, Записсь CD-DVD, Драйверы, софт, программы, оформление, microsoft


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

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: