function onAllPhotosLoaded() { for (var i:Number=0; i<_photos.length; i++) { // put all the photos into a variable each loop var thisPhoto:Photo = _photos[i]; // y co-ord var nY:Number=110; // x co-ord var nX:Number; // stolen from some old code, basically setting the spacing between each picture, it increases the //spacing as the loop increments nX = 25 + (_photos.length * 10) + (i * 78); // create a movieclip to load the photos into var mc:MovieClip = _root.createEmptyMovieClip("photo"+i, i); mc.createEmptyMovieClip("img", 1); // and load the image into it mc.img.loadMovie(thisPhoto.thumbnailUrl); mc.photo = thisPhoto; // position the images using our co-ords mc._x = nX; mc._y = nY; // open photo page when photo clicked mc.onPress = function() { getURL(this["photo"].photoPageUrl, "_blank"); }; } }