FlickrViewerï¼as3flickrlibã使ã£ã¦Flickrããç»åãèªã¿è¾¼ãæ¹æ³
Flickrãæ¤ç´¢ãã¦è¡¨ç¤ºããViewerãä½ã£ã¦ã¿ã¾ããã
ç»åã®åå¾ã«ã¯ãAdobe Labsã§ä½æãããas3flickrlibã¨ããã©ã¤ãã©ãªã使ã£ã¦ãã¾ãã
ãã®ã©ã¤ãã©ãªã¯ããµã³ãã«ã³ã¼ããä»å±ãã¦ããããã¾ã解説ãã¦ããè¨äºãã¿ãããªãã®ã§è©¦ãã«ä½¿ã£ã¦ã¿ã¾ããã
ã¾ããFlickrã¸ã®ã¢ã¯ã»ã¹ã¯ã¯ãã¹ãµã¤ãã®ãã¼ã¿ã¢ã¯ã»ã¹ã¨ãªãããcrossdomain.xmlãèªã¿è¾¼ã¿ãå¿ è¦ã¨ãªãã¾ãããã®æ¹æ³ã«ã¤ãã¦ã説æãã¾ãã
as3flickrlibã¨ã¯
as3flickrlibã¯ãAdobe Labsã§ä½æãããas3ç¨ã®Flickr APIã©ããã¼ã©ã¤ãã©ãªã§ãã
ãã®ã©ã¤ãã©ãªã使ãã¨URLLoaderãªã©ã使ã£ã¦ç´æ¥APIãå¼ã³åºããå ´åã¨æ¯ã¹ã¦ããã¼ã¿ã®åã渡ãã楽ã«ãªããªã©ã®ã¡ãªãããããã¾ãã
ä»åãµã³ãã«ã¨ãã¦åãä¸ããã®ã¯æ¤ç´¢ç¨APIã®ã¿ã§ããã¢ãããã¼ãAPIã«é¢ãã¦ã¯ãhatayanããã®ãã®ã¨ã³ããªã¼ãåèã«ãªãã¾ãã
as3flickrlibã使ãããã®æºå
as3flickrlibã¯as3corelibã«ä¾åãã¦ããããä¸è¨URLããå ã«ãã¦ã³ãã¼ããã¦ä¸ããã
http://code.google.com/p/as3corelib/
次ã«ãas3flickrlibãä¸è¨URLãããã¦ã³ãã¼ããã¦ä¸ããã
http://code.google.com/p/as3flickrlib/
ãã¦ã³ãã¼ãããZIPãã¡ã¤ã«ãå±éããsrc/以ä¸ã®ãã¡ã¤ã«ãã¯ã©ã¹ãã¹ãéã£ã¦ãããã£ã¬ã¯ããªã«ã³ãã¼ãã¦ä¸ããã
ç§ã使ç¨ããas3flickrlibã®ãã¼ã¸ã§ã³ã¯ã0.87ãªã®ã§ããããã®ãã¼ã¸ã§ã³ã«ã¯ç»åã®URLçæã«å¿ è¦ãªfarm idãåå¾ã§ããªãã¨ããæ¬ é¥ããã£ãããä¸è¨ã®ä¿®æ£ãè¡ãã¾ãããããããã¡ã¤ã«ããã¡ãã«ç¨æãã¾ãã¾ããã
as3flickrlibãfarmãç¡è¦ãã¦ããåé¡ãåé¿ããããã®ä¿®æ£ç¹
src/com/adobe/webapis/flickr/Photo.asã«è¿½å
private var _farm:String; public function get farm():String { return _farm; } public function set farm( value:String ):void { _farm = value; }
farm idãæ ¼ç´ããããã®ã¡ã³ãå¤æ°ã¨ããããã£ã追å ãã¾ããã
src/com/adobe/webapis/flickr/methodgroups/MethodGroupHelper.asã®370è¡ç®ã«è¿½å
photo.farm = [email protected]();
æ¤ç´¢çµæãPhotoãªãã¸ã§ã¯ãã«è¿½å ãã¦ããç®æã§farm idãèªã¿è¾¼ãããã«ä¿®æ£ãã¾ããã
as3flickrlibã®ãã¼ã¸ãã¿ãã¨æ¢ã«ãã°å ±åã¨ãã¦ããã£ã¦ããã®ã§ãã®ãã¡ä¿®æ£ãããã®ã§ã¯ãªããã¨æãã¾ãã
as3flickrlibã使ã£ã¦ã¿ã
å®éã«as3flickrlibã使ã£ã¦ããã¼ã¯ã¼ãã«ä¸è´ããåçã®ä¸è¦§ãåå¾ãç»åã®URLãçæããã¨ããã¾ã§ç´¹ä»ãã¾ããã¾ããcrossdomain.xmlã®èªã¿è¾¼ã¿æ¹ã«ã¤ãã¦ã説æãã¾ãã
ã¯ããã«ãcom.adobe.webapis.flickr.FlickrServiceã®ã¤ã³ã¹ã¿ã³ã¹ãä½æãã¾ãããã®ã¨ãå¼æ°ã«æ¸¡ãAPI KEYã¯Flickrã®ã¢ã«ã¦ã³ããä½æããã°åå¾ãããã¨ãã§ãã¾ãã
this.flickr = new FlickrService(FLICKR_APIKEY);
ã¤ãã«å ã»ã©ä½æããã¤ã³ã¹ã¿ã³ã¹ã«ã¤ãã³ããã³ãã©ãç»é²ãã¾ããä»åã¯ãã¼ã¯ã¼ãæ¤ç´¢ãå®è¡ããã®çµæãåå¾ãããã®ã§ãPHOTOS_SEARCHã¤ãã³ãã®ãã³ãã©ãç»é²ãã¾ãã
this.flickr.addEventListener(FlickrResultEvent.PHOTOS_SEARCH, flickr_onPhotosSearch);
ã¤ãã³ããã³ãã©ãåãåãã¤ãã³ãã¯FlickrResultEventåã§ãsuccessããããã£ã«APIã®å¼ã³åºããæåãããã©ãããè¨å®ããã¾ãã
APIã®å®è¡çµæã¯ãdataããããã£ã«è¨å®ããã¾ãã
Photos.search()ãå¼ã³åºããéã®å®è¡çµæã¯PagedPhotoListãªãã¸ã§ã¯ãã¨ãã¦è¿ããã¾ãã
private function flickr_onPhotosSearch(event:FlickrResultEvent):void
{
if ( event.success )
{
var photos:Array = PagedPhotoList(event.data['photos']).photos;
for ( var i:int = 0; i < photos.length; i++ )
{
var imageUrl:String = 'http://farm' + photos[i].farm + '.static.flickr.com/' +
photos[i].server + '/' + photos[i].id + '_' + photos[i].secret + '.jpg';
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_onComplete);
loader.load(new URLRequest(imageUrl), new LoaderContext(true));
}
}
}
ãã®ãªãã¸ã§ã¯ãã¯Flickr APIã®searchãå¼ã³åºããéã®å®è¡çµæãã®ãã®ãªã®ã§FlickrAPIã使ã£ããã¨ããã人ã§ããã°ã©ã®ãããªçµæãè¿ã£ã¦ãã¦ãããã§è¿·ããã¨ã¯ãªããã¨æãã¾ãã
Flickrã®ãµã ãã¤ã«ç»åã®URLãçæããã«ã¯ãfarm idãå¿ è¦ã«ãªãã¾ããURLã®ãã©ã¼ãããã«ã¤ãã¦ã¯å¯ºåå±æªæºããã®ãã®ã¨ã³ããªã¼ãåèã«ãã¾ããã
Flickrã§ã¯ãµã ãã¤ã«ç»åãä¿åããã¦ããfarmãã¨ã«crossdomain.xmlãé ç½®ããã¦ãã¾ãããã®ãããLoaderã®load()ãªãã¸ã§ã¯ãã®ç¬¬ï¼å¼æ°ã«checkPolicyFileããããã£ãtrueã«è¨å®ããLoaderContext()ã渡ãã¾ãã
Loaderã¯checkPolicyFileãtrueã«ãªã£ã¦ããå ´åãcrossdomain.xmlãæ¢ãããã«ãªãã¾ãããµã³ãã«ã³ã¼ãã§ã¯ãLoaderContext()ã®ã³ã³ã¹ãã©ã¯ã¿ã®ç¬¬ï¼å¼æ°ã§è¨å®ãã¾ããã
æå¾ã«Flickr APIãå¼ã³åºãã¾ããå¼ã³åºãã¯ãæåã«ä½æããFlickrServiceãªãã¸ã§ã¯ãã®ããããã£ãéãã¦è¡ãã¾ãã
ãã®å¼ã³åºããFlickr APIã®flickr.photos.searchãã®ãã®ã§ãããã ããAPIKEYã¯FlickrServiceçææã«æ¸¡ãããã®ã使ãããããåã ã®APIå¼ã³åºãã§ã¯ä¸è¦ã§ãã
this.flickr.photos.search("", "", "any", keyword);
ã§ã使ç¨æã¯ã©ãã ã£ãã®ãï¼
APIå¼ã³åºãã®çµæãèªåã§è§£æããªãã¦è¯ããã¨ã¯ã¡ãªããã«æãããã¾ããããã®ç¹ã«é¢ãã¦ã¯ãåçãã¢ãããã¼ããããã¨è©¦ã¿ãå ´åã«æ©æµãããã®ã ããã¨æãã¾ãã
ã¾ããFlash 㧠Flickr ã«åçãã¢ãããã¼ããããµã³ãã«ï¼FlashCS3 + Action Script3ï¼ã«ããã¨
â»æ®å¿µãªããwww.flickr.comã®ãµã¼ãã¼ã«"crossdomain.xml"ããªãã®ã§(api.flickr.comã«ã¯ããã)swfãwebã«ã¢ããããç¶æ ããã¯ã¢ãããã¼ãã®å¦çããã¾ãåãã¾ããã§ããããã¼ã«ã«ã§å®è¡ãã¦ãã ããã
ã¨ãããã¨ãªã®ã§ããã®ã©ã¤ãã©ãªã®å©ç¨ã¯AIRã¢ããªã«Flickrã¸ã®ã¢ãããã¼ãæ©è½ãä»ãããå ´åãªã©ä½¿ç¨æ¹æ³ã¯éå®ãããæãããã¾ãã
ã½ã¼ã¹ã³ã¼ãã¨ã³ã³ãã¤ã«æ¹æ³
ãã¡ã¤ã«ä¸å¼ã¯ãããããã¦ã³ãã¼ããã¦ä¸ãããã³ã³ãã¤ã«ã«ã¯ãflex3 sdkã¨Papervision3D 2.0ã¨as3corelibã¨as3flickrlibãå¿ è¦ã§ãã
Papervision3D 2.0ã¯ã¾ã ã¢ã«ãã¡ãªãªã¼ã¹ãªã®ã§svnããç´æ¥ãã¦ã³ãã¼ãããããå ¥ææ¹æ³ãããã¾ãããsvnã³ãã³ãã使ããç°å¢ã§ããã°ã以ä¸ã®ã³ãã³ãã§å ¥æåºæ¥ã¾ãã
$svn co http://papervision3d.googlecode.com/svn/trunk papervision3d
ã³ãã³ãå®è¡å¾ãbranches/GreatWhite/src以ä¸ã«ã¯ã©ã¹ãã¹ãéãã¦ä¸ããã
ã¾ããã½ã¼ã¹ãã¡ã¤ã«ã«ã¯fickrã®APIKEYãå«ã¾ãã¦ããªãã®ã§åèªåå¾ãã¦èªåã®APIKEYãå ¥åãã¦ä¸ããã
æå¾ã«
ä»åã¯ãas3flickrlibã®èª¬æãã¡ã¤ã³ã«æ¸ãã¾ããããPapervision3D 2.0ã使ã£ã¦ã¿ãææ³ãå¾æ¥ã¬ãã¼ããããã¨æãã¾ãã
åè
- Flash 㧠Flickr ã«åçãã¢ãããã¼ããããµã³ãã«ï¼FlashCS3 + Action Script3ï¼
- Splash.image.jsã使ãã(6) - with FlickrAPI ãµã ãã¤ã«ç»åã®URLã¨æ¤ç´¢çµæXMLã®é¢ä¿ãããããããã¾ã¨ãããã¦ãã¾ã
- Flickr Services
- as3corelib
- as3flickrlib