Flex and Flickr and DisplayShelf

I’ve been working with the fabulous DisplayShelf code from simplyscheming.com to try to make various types of browsers in Flex. Yesterday, I *just about* had it working to browse images from flickr, but I ran into the old ‘checkpolicyfile’ problem. Even though Flickr has been nice enough to put crossdomain.xml files on all their static servers, the DisplayShelf code needs to manipulate the image as a bitmap to make the groovy reflection underneath the picture.

I found places where people fixed this problem by changing LoadContext, and other places where people added trustContent to the Image, but I couldn’t figure out how to make this work correctly in the context of DisplayShelf.

Fortunately, there in the code was a reference to someone I’d worked with a zillion years ago (ok, 13), and I pinged him to ask for help. He gave me the magic answer, which looks like this (you’ll need to ‘view source’ to see it, I’m not sure how to get HTML-ish things to show up in MT).

Original DisplayShelf component in mxml:
<local:displayshelf id="shelf" borderthickness="2" bordercolor="#000000" dataprovider="{dataSet}" enablehistory="false" width="7" angle="10" popout=".35" change="currentInfo();">
New DisplayShelf component:
<local:displayshelf id="shelf" height="300" borderthickness="2" bordercolor="#000000" dataprovider="{DataModel.getInstance().photoInfo}" enablehistory="false" width="5" angle="10" popout=".35" change="currentInfo();">
<mx:image trustcontent="true">

Seemed a little obscure, but it works and now my browser is happy.

Thanks to NJ for saving my sanity 🙂

api flex flickr

Dialogue & Discussion