![]() |
|||||||
Hybrid Hacking provides tutorials on how to integrate with some of today's hottest web services.
|
Build a Flex-based Facebook Photo Browser
Fri, 07/06/2007 - 20:46
This tutorial continues on the process put forth in the first Facebook tutorial Building Facebook Applications with Flex. After following the steps laid out in the first tutorial, all you will need to do is add a few lines of code to the MXML file. This demo application will first load all of your Facebook albums into a DataGrid. When one of those albums is clicked, the photos in that album will be displayed in another DataGrid. Note: This tutorial uses the ActionScript 3 Facebook Library. Thanks to Jason Crist of Terralever for his work on this and providing it to the development community. Starting with the FacebookExample.mxml file from the first tutorial, there are only a few changes to be made. First add a new bindable variable that will hold the photos of the chosen album: [Bindable] private var albumPhotos:Array; Then add the getPhotos and getPhotosReply functions: private function getPhotosReply(event:Event):void {
albumPhotos = event.target.photos;
}
private function getPhotos(event:Event):void {
albumPhotos = new Array();
facebook.photos_get(null, event.target.selectedItem.aid, null, getPhotosReply);
}Then add the itemClick property to the DataGrid that holds the photo albums, <mx:DataGrid x="9" y="195" dataProvider="{photoAlbums}" width="180" height="225" itemClick="getPhotos(event)">This will call the getPhotos function when the user selects a photo album. Finally add the new DataGrid to hold the photos: <mx:DataGrid x="197" y="195" width="75" rowHeight="75" height="225" dataProvider="{albumPhotos}" headerHeight="0">
<mx:columns>
<mx:DataGridColumn headerText="" dataField="src_small" itemRenderer="mx.controls.Image" />After making these changes, run the application and you should have a very basic Flex-based Facebook Photo Browser. Here is the final code in an MXML file: FacebookPhotoBrowser.mxml (3KB) Comments
Tue, 03/17/2009 - 20:09 — OliviaB. (not verified)
With this application, I can reduce the amount of time it takes to upload my pictures on the internet. I mean, it already takes time to do it in the first place, but uploading on multiple social sites can multiply the time. Thanks for your help!
Sun, 04/19/2009 - 05:20 — Alex Cook (not verified)
Sweet! Thanks for putting this together. Can you zip up the complete project (with all the classes)? I went to Terr.'s site, but I can't find his classes easily. Thanks, Alex
Fri, 04/24/2009 - 19:45 — Tarek (not verified)
I want to connect facebook for my air application with adobe cs4. But i can't do it. Can u help me to do same thing from adobe flash cs4. I have google it but didn't get any solution.. pls help me . Post new comment |
||||||