loadFriends problem

1 view
Skip to first unread message

cesare76

unread,
Feb 25, 2008, 4:20:35 PM2/25/08
to Twitter Development Talk
Hi,

I tried both as2 and as3 libraries.

When I try to retrieve my friends' timeline:


Twitter t = new Twitter();
t.setAuth(user, password);
t.loadFriends(user);

I get a list of TwitterStatus elements.
But they are all empty. They are 44 (as my friends) but text,
user.name, everything is void.

Looking at the code I found that the library points here:

twitterRequest("http://twitter.com/statuses/friends/"+userID+".xml")

I tried that in the browser, with my id:

http://twitter.com/statuses/friends/_funkyboy.xml

and that works fine, I get the xml of my friends with data, statuses,
pictureURL, etc.

This happens both with as2 and as3.

What's wrong?

-c.

cesare76

unread,
Feb 25, 2008, 4:59:16 PM2/25/08
to Twitter Development Talk
gotcha!

loadUserTimeline returns a list of statuses
loadFriends returns a list of users

but the code in the handler is the same!!!

I solved lazily ...

I changed friendsHandler this way:

var o:Object = tempXML.status;
o.user = tempXML;
var twitterStatus:TwitterStatus = new TwitterStatus (o);

not an elegant solution ... but quick!

-c.

Michael

unread,
Apr 8, 2008, 12:04:53 AM4/8/08
to Twitter Development Talk
I noticed the same problem. I changed friendsHandler to return an
array of users:

private function friendsHandler(e:Event):void {
var xml:XML = new XML(_friendsLoader.data);
var userArray:Array = new Array();
for each (var tempXML:XML in xml.children()) {
var twitterUser:TwitterUser = new TwitterUser(tempXML);
userArray.push(twitterUser);
}
var r:TwitterEvent = new TwitterEvent
(TwitterEvent.ON_FRIENDS_RESULT);
r.data = userArray;
dispatchEvent (r);
}

All of the other calls (correctly) return arrays of TwitterStatus.
Looks like a copy and paste error to me, or maybe the API changed at
some point and the code was not kept up to date.

-- Michael
Reply all
Reply to author
Forward
0 new messages