Buddy State update

Post here your questions about the Flash / Flex / Air API for SFS2X

Moderators: Lapo, Bax

pauloamorimbr
Posts: 17
Joined: 05 Nov 2010, 15:31

Buddy State update

Postby pauloamorimbr » 22 Feb 2011, 18:53

Hi there all.

I'm working on a friends list and started using the buddy list system. It all worked well for me until I tried to get online updates of buddy states.

Server side: JAVA:

Initializing buddy list
Adding each friend (from a database) as TEMP

FLASH:

This runs on a ENTER_FRAME event...

txtStatus.text = sfs.buddyManager.buddyList.length.toString();
for each( var b:SFSBuddy in sfs.buddyManager.buddyList )
{
txtStatus.appendText( "\n - " + b.name + ":" + b.isOnline + " - " + b.state );
}

THE PROBLEM:

At certain points I change the state of a friend, but it never updates on flash. It works online really well for online/offline, but the state never updates.

If I log out and in again, I see the correct state of my friend, but when I change it again, it wont update till I log in again.


Am I doing something wrong? Am I lacking some step?

Pls help!

Thanks a ton!
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 23 Feb 2011, 08:29

Personally I think that using an enter frame event to update the list is the wrong approach. Simply listen to the buddy-related events fired by the SFS API. In particular, the SFSBuddyEvent.BUDDY_VARIABLES_UPDATE contains the state update (because the state is saved in a buddy variable).
With the RC2 we will be releasing a Flex example showing the Buddy List features usage.
Paolo Bax
The SmartFoxServer Team
pauloamorimbr
Posts: 17
Joined: 05 Nov 2010, 15:31

Postby pauloamorimbr » 23 Feb 2011, 12:41

Oh, hey there, thanks for the answer!

The enterframe stuff I'm using is for debugging only purposes, but it does show me that the variables are not changing.

I will try listening to the events and making some tests too.

If anyone has another info regarding this subject I'll be happy to hear! :)

thanks

Return to “SFS2X ActionScript 3 API”

Who is online

Users browsing this forum: No registered users and 12 guests