/ Published in: ActionScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import com.kelvinluck.flashr.core.Flashr; import com.kelvinluck.flashr.core.Photo; import com.kelvinluck.flashr.core.Photoset; import com.kelvinluck.flashr.core.Person; import com.kelvinluck.flashr.core.FlashrResponse; import com.kelvinluck.util.LogWrapper; import com.dynamicflash.utils.Delegate; class com.cecymeade.UserRecentPhotos { var xMax:Number = 214; var yMax:Number = 214; var xTemp:Number; var yTemp:Number; var apiKey:String = "Your Flickr API key here"; var userNsid:String = "90349680@N00"; var _target:MovieClip; function UserRecentPhotos(target:MovieClip) { Stage.scaleMode = "noScale"; LogWrapper.getInstance().init(); LogWrapper.getInstance().addTracePublisher(); _target = target; var _flashr:Flashr = Flashr.getFlashr(); _flashr.apiKey = apiKey; var _flashrResponse:FlashrResponse = new FlashrResponse(); _flashrResponse.setSuppressOutput(true); _flashrResponse.onPeopleGetPublicPhotos = Delegate.create(this, onPeopleGetPublicPhotos); _flashr.peopleGetPublicPhotos(userNsid, null, 16, 1); } function onPeopleGetPublicPhotos(p:Person):Void { var photosArray:Array = p.getPhotos(); var userNsid:String = p.nsid; for (var i:Number = 0; i var thisPhoto:Photo = Photo(photosArray[i]); var mc:MovieClip = _target.createEmptyMovieClip("photo"+i, i); mc._x = 1+(i%4)*76; mc._y = 1+Math.floor(i/4)*76; mc.createEmptyMovieClip("jpgHolder", 1); mc.jpgHolder.loadMovie(thisPhoto.thumbnailUrl); mc.xMax = xMax; mc.yMax = yMax; var freeDepth = (_root.getNextHighestDepth()); mc.onRollOver = function() { xTemp = this._x; yTemp = this._y; this._x = Math.min(xTemp, xMax); this._y = Math.min(yTemp, yMax); this.swapDepths(freeDepth); this._xscale = this._yscale=120; }; mc.onRollOut = function() { this._x = xTemp; this._y = yTemp; this._xscale = this._yscale=100; }; mc.photo = thisPhoto; mc.onPress = function() { getURL(this["photo"].photoPageUrl, "_blank"); }; } } public static function main():Void { var u:UserRecentPhotos = new UserRecentPhotos(_root); } public function toString():String { return "[com.cecymeade.UserRecentPhotos]"; } }