I’m working on a piece of an app that will allow a user to choose multiple friends from a list and move on from there (what they’ll do isn’t important, nor is it entirely determined at this point).
I have no problem going through the SSO and Json decoding the data return once they OK my FB app, but need to pull in thumbnail images and have them associated with the correct user ID. Seems simple enough. The code I’m using to pull in images looks like this:
[lua] local function showImage( event )
scrollView:insert(event.target)
scrollView:addFBImage(event.target)
end
for i=1,#data do
display.loadRemoteImage(“http://graph.facebook.com/”… data[i].id …"/picture",
“GET”,
showImage,
“friend”…i…".png",
system.TemporaryDirectory )
if i == table.maxn(data) then
print("iteration finished at " … i)
scrollView:setFriendsLength(i)
end
end[/lua]
The showImage callback works like a charm, lays them all out and inserts them into a scrollView. However, the callback doesn’t allow me to associate the user ID with that particular image (no parameters allowed), and I gather through print/trace experiments that it’s possible for the callbacks to be called out of order (in other words, I can’t make a parallel table with user ID’s and be sure they will match up 1:1). I may be wrong about that last part but would rather be safe than sorry.
Is there a better way to do this?
Thanks in advance.
Danny [import]uid: 103470 topic_id: 27835 reply_id: 327835[/import]