only using some componets

Everything about the SmartFoxBits UI Components for SmartFoxServer 1.x. Post your questions, suggestions and bug reports.

Moderators: Lapo, Bax

Post Reply
rkrass
Posts: 7
Joined: 05 Sep 2007, 21:45

only using some componets

Post by rkrass »

i dl the software package yesterday and started playing with it. i can use all the components at run time or i can use them all at authoring time.
im having a real struggle in only being able to integrate parts of the componets (room list, user list) at authortime and getting them to integrate with other things using the api.
basically i want to connect manually, join a room and then use the userlist to display the list of users. is there a way to do this?
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

If I understand clearly, you would like to use the UserList component only, and not the other SmartFoxBits. Right?
SmartFoxBits are independent one from each other... almost! The only dependency is given by the Connector: all the other Bits rely upon it to get access to SmartFoxServer connection and events.
So, all you need to do is use the Connector in conjunction with the UserList, and use its APIs to implement the other features of your application.
Hope this helps.
Paolo Bax
The SmartFoxServer Team
rkrass
Posts: 7
Joined: 05 Sep 2007, 21:45

Post by rkrass »

that must have been my problem ( wasnt using the connector)

so if i use the connector - get a connection - i can then use my own script / work with api programmtically

so i connect -> then i want to send the username manually. what is the defult connection name. - sfs. or smartFox. or what ?
basically what is the name of the variable being used.

thanks for your help
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

Check the Connector.connection property in the Connector's API documentation.
One more thing: if you are using the Connector, in order to listen to SmartFoxServer events use the Connector's appropriate method (addEventListener). Again, checK the documentation and examples.
Paolo Bax
The SmartFoxServer Team
rkrass
Posts: 7
Joined: 05 Sep 2007, 21:45

Post by rkrass »

thanks for your help btw.

i got the componets to work interchangeably - some i did by hand, some i used the componets for.

heres the problem i've ran into now. I want to use the smartFoxBits userListcomponet but i want to use it + add features.
for example when a user enters the room i want to use the onUserEnterRoom. i want the userlist to still work but i want to do run my own code as well.
ive noticed when i use this

Code: Select all

smartfox.onUserEnterRoom = function(fromRoom, user)
{
trace("here");
}
the list wont update, etc (it wont even work). So basically i assume that my event-handler overwrites the defult one and my code is ran instead of the defult.

I want to run both.

My code + the default.

my thought was to add another event listener

Code: Select all

roomList.addEventListener(SFSEvent.onUserEnterRoom, myListener)
function myListener(evt:SFSEvent):Void
{
	trace("HERE");
}
but doesnt seem to work either.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

That's why in my previous post I told you to use the Connector's addEventListener :D
As you correctly say, if you set an event listener directly using the SmartFoxClient instance, you overwrite the same event listener used by the Connector. So you have to add your listener to the Connector.
This is what you should do:

Code: Select all

import it.gotoandplay.smartfoxbits.events.*
import mx.utils.Delegate
 
connector.addEventListener(SFSEvent.onUserEnterRoom, Delegate.create(this, myListener))
 
private function myListener(evt:SFSEvent):Void
{
	trace("HERE")
}
Paolo Bax
The SmartFoxServer Team
Post Reply