Posted By


swfgeek on 05/19/08

Tagged


Statistics


Viewed 568 times
Favorited by 0 user(s)

Flashr UserRecentPhotos


/ Published in: ActionScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. import com.kelvinluck.flashr.core.Flashr;
  2. import com.kelvinluck.flashr.core.Photo;
  3. import com.kelvinluck.flashr.core.Photoset;
  4. import com.kelvinluck.flashr.core.Person;
  5. import com.kelvinluck.flashr.core.FlashrResponse;
  6. import com.kelvinluck.util.LogWrapper;
  7. import com.dynamicflash.utils.Delegate;
  8.  
  9. class com.cecymeade.UserRecentPhotos {
  10. var xMax:Number = 214;
  11. var yMax:Number = 214;
  12. var xTemp:Number;
  13. var yTemp:Number;
  14. var apiKey:String = "Your Flickr API key here";
  15. var userNsid:String = "90349680@N00";
  16. var _target:MovieClip;
  17.  
  18. function UserRecentPhotos(target:MovieClip) {
  19. Stage.scaleMode = "noScale";
  20. LogWrapper.getInstance().init();
  21. LogWrapper.getInstance().addTracePublisher();
  22. _target = target;
  23. var _flashr:Flashr = Flashr.getFlashr();
  24. _flashr.apiKey = apiKey;
  25. var _flashrResponse:FlashrResponse = new FlashrResponse();
  26. _flashrResponse.setSuppressOutput(true);
  27. _flashrResponse.onPeopleGetPublicPhotos = Delegate.create(this, onPeopleGetPublicPhotos);
  28. _flashr.peopleGetPublicPhotos(userNsid, null, 16, 1);
  29. }
  30.  
  31. function onPeopleGetPublicPhotos(p:Person):Void {
  32. var photosArray:Array = p.getPhotos();
  33. var userNsid:String = p.nsid;
  34. for (var i:Number = 0; i
  35. var thisPhoto:Photo = Photo(photosArray[i]);
  36. var mc:MovieClip = _target.createEmptyMovieClip("photo"+i, i);
  37. mc._x = 1+(i%4)*76;
  38. mc._y = 1+Math.floor(i/4)*76;
  39. mc.createEmptyMovieClip("jpgHolder", 1);
  40. mc.jpgHolder.loadMovie(thisPhoto.thumbnailUrl);
  41. mc.xMax = xMax;
  42. mc.yMax = yMax;
  43. var freeDepth = (_root.getNextHighestDepth());
  44. mc.onRollOver = function() {
  45. xTemp = this._x;
  46. yTemp = this._y;
  47. this._x = Math.min(xTemp, xMax);
  48. this._y = Math.min(yTemp, yMax);
  49. this.swapDepths(freeDepth);
  50. this._xscale = this._yscale=120;
  51. };
  52. mc.onRollOut = function() {
  53. this._x = xTemp;
  54. this._y = yTemp;
  55. this._xscale = this._yscale=100;
  56. };
  57. mc.photo = thisPhoto;
  58. mc.onPress = function() {
  59. getURL(this["photo"].photoPageUrl, "_blank");
  60. };
  61. }
  62. }
  63.  
  64. public static function main():Void {
  65. var u:UserRecentPhotos = new UserRecentPhotos(_root);
  66. }
  67.  
  68. public function toString():String {
  69. return "[com.cecymeade.UserRecentPhotos]";
  70. }
  71.  
  72. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.