menu

Blog

  • Working with Flickr API from ActionScript 3

    First, load crossdomain, otherwise will not let you use Bitmap data.

    Source is important as .swc is out of date

    • http://code.google.com/p/as3flickrlib/source/checkout
    • http://code.google.com/p/as3corelib/source/checkout
    • http://groups.google.com/group/as3flickrlib

        import com.adobe.webapis.*;
        import com.adobe.webapis.flickr.*;
        import com.adobe.webapis.flickr.events.*;
    
        public const APIKEY:String = "adf569d38227fb6ef9be9d1561048412";
        public const APISECRET:String = "85d8f7e53294356c";
        
        public var flickr:FlickrService;
    
            flickr = new FlickrService(this.APIKEY);
            flickr.secret = this.APISECRET;
            
            
            var a:String = "TEST STRING PASSED";
            flickr.addEventListener(FlickrResultEvent.TEST_ECHO, onEcho);
            flickr.test.echo(a);
                            
            flickr.addEventListener(FlickrResultEvent.PEOPLE_GET_PUBLIC_PHOTOS, onPublic);				
            flickr.people.getPublicPhotos('15711607@N07');
        }
        private function onEcho(e:FlickrResultEvent):void{
            trace("Result is ", e.success);
        }
        
        private function onPublic(e:FlickrResultEvent):void{
            var photoList:PagedPhotoList = PagedPhotoList(e.data.photos);
            trace("Public photos received");
            for each(var p:Photo in photoList.photos){
                    var squareUrl:String = "http://static.flickr.com/" + p.server + "/" + p.id + "_" + p.secret + "_s.jpg";
                    p.url = squareUrl;
                    cMain.arrPhotos.addItem(p);
            }	
            
        }