Page 2 of 2

Re: UserList not enabled / showing existing users

Posted: 22 Nov 2012, 21:15
by mmancuso
Okay it looks like I've solved it (albeit via a bit of a hack). I'll leave it here in hopes that this helps someone else.

I removed the sfb:Connector from my MAIN.mxml component and put manual code at the top of my init() method to manually instantiate the connector

Code: Select all

connector = new Connector();
	smartFox = Connector.smartFox;
then in another function, after the user logs in, I call

Code: Select all

connector.connect()
I'm able to refresh the userList when OpenSpace loads, but I was still having the same problem when I was creating my THEATER.mxml component (userList appeared disabled, error appeared if I tried to refresh the userList). I experimented with where in the execution process I placed the refresh code, and the only solution that has worked consistently for me, was to set a 1 second timer to be called when my THEATER.mxml component is created. Every second we try to refresh the userList. If it errors, then we don't stop the timer, if it doesn't, then we stop the timer and the userList has been successfully refreshed.

Code: Select all

userlistid = setInterval(refreshUserList, 1000);

private function refreshUserList()
{
	try
	{
		this.userListTwo.refreshList();
		clearInterval(userlistid);
	}
	catch (e:TypeError)
	{
		trace('type error trying to refresh userList...');	
	}	
}

Not the most ideal way, but it's good enough for now. Hopefully it keeps working. Thanks for your help Bax!

Re: UserList not enabled / showing existing users

Posted: 23 Nov 2012, 08:56
by Bax
Having two Connectors is a wrong approach. You need just one, which must be always available (even if hidden).
So make sure you are not destroying the component which contains the Connector.

Re: UserList not enabled / showing existing users

Posted: 23 Nov 2012, 15:44
by mmancuso
I thought I was just creating one connector since I removed the sfb:Connector component?

Re: UserList not enabled / showing existing users

Posted: 25 Nov 2012, 17:29
by Bax
Sorry, I don't understand your question. Can you rephrase?