An issue with photos.getSizes

0 views
Skip to first unread message

jassa

unread,
Jul 23, 2008, 9:58:02 AM7/23/08
to ActionScript 3 Flickr Library
Hi,

Just a quick question re photos.getSizes. What I'm trying to do is
create thumbnails for each photo set for leader. So I loop through the
list of photoSets and get the primaryPhotoId for each set, then I run
a getSizes method on it to get the square photo value and then I push
that to an array for later use. In theory this should work but for
during the getSizes method, the values aren't dealt with consistently
and consequently my array comes out in a different order each time.
I'm guessing that the loop executes a lot faster than the getSizes
method and the getSizes method just pushes the values as soon as they
get done, if they're in the correct order or now.

Does anyone have any ideas about how to get around this, or if I can
optimize my code to get the Array in the correct order.

My code currently looks like this:

private function getPhotos():void {
fs.photosets.getList("MyUserId");
fs.addEventListener(FlickrResultEvent.PHOTOSETS_GET_LIST,
handleSets);
}
private function handleSets(e:FlickrResultEvent):void {
photoSetArray = e.data.photoSets;
for(var j:uint = 0; j < e.data.photoSets.length; j ++){
fs.photos.getSizes(_set.primaryPhotoId);
fs.addEventListener(FlickrResultEvent.PHOTOS_GET_SIZES,
setPrimaryPhoto);
}
}
private function setPrimaryPhoto(e:FlickrResultEvent):void{
var sizeList:Array = e.data.photoSizes;
photoSetThumbArray.push(sizeList[0].source);
}
Reply all
Reply to author
Forward
0 new messages