Previous | Next | Frames | No Frames |
Summary: Field | Property | Contructor | Method | Detail: Field | Property | Contructor | Method |
MovieClip | +--it.gotoandplay.smartfoxbits.bits.UserList
import it.gotoandplay.smartfoxbits.bits.UserList var userList_mc:UserList = UserList(attachMovie("UserList", "userList_mc", 3)) userList_mc.enablePrivateChat = false
NOTE 1: importing the it.gotoandplay.smartfoxbits.bits.UserList class and casting the UserList's movieclip to it is useful if you intend to use a development tool having code-completion features. Otherwise this is enough:
var userList_mc = attachMovie("UserList", "userList_mc", 3)NOTE 2: in the following examples userList_mc represents the UserList instance name.
Property Summary | |
public | banButton: Button (read-only) |
A reference to the "ban" Button component. | |
public | banButtonText: String (read, write) |
The label of the "ban" button. | |
public | banMessage: String (read, write) |
The message sent to a user when being banned by the Moderator. | |
public | enablePrivateChat: Boolean (read, write) |
Enable/disable private chat and moderation features. | |
public | height: Number (read, write) |
The height of the UserList component on the stage, in pixels. | |
public | iconFunction: Function (read, write) |
A reference to a custom method to be invoked when attaching the room icon movieclip. | |
public | kickButton: Button (read-only) |
A reference to the "kick" Button component. | |
public | kickButtonText: String (read, write) |
The label of the "kick" button. | |
public | kickMessage: String (read, write) |
The message sent to a user when being kicked by the Moderator. | |
public | labelFunction: Function (read, write) |
A reference to a custom method to be invoked when rendering the room labels, to set their text. | |
public | labelMargin: Number (read, write) |
The space between the list item left border and the label. | |
public | moderateLabel: Label (read-only) |
A reference to the "moderation module" Label component. | |
public | moderateLabelTxt: String (read, write) |
The label text of the moderation module. | |
public | newPrivateMsgLabelColor: Number (read, write) |
The color of user label when a private message is received. | |
public | privateChat: ChatBox (read-only) |
A reference to the "private chat" ChatBox component. | |
public | privateChatLabel: Label (read-only) |
A reference to the "private chat module" Label component. | |
public | privateChatLabelTxt: String (read, write) |
The label text of the private chat module. | |
public | rowHeight: Number (read, write) |
The height of the list items. | |
public | showFocusRectangle: Boolean (read, write) |
Show/hide the focus rectangle around the user list, the private ChatBox, and the kick/ban buttons. | |
public | showIcons: Boolean (read, write) |
Show/hide the user icons. | |
public | sortOrder: String (read, write) |
The users' sorting order. | |
public | spacing: Number (read, write) |
The number of pixels dividing the UserList sub-components (private ChatBox, kick/ban buttons, etc.). | |
public | usersList: AdvancedList (read-only) |
A reference to the inner AdvancedList component. | |
public | useSmartList: Boolean (read, write) |
Enable/disable the "Smart List" feature. | |
public | width: Number (read, write) |
The width of the UserList component on the stage, in pixels. | |
Constructor | |
UserList ( ) | |
UserList class constructor. Initializes the component. | |
Method Summary | |
public | addEventListener ( type: String, listener: Function ): Void |
Register a listener function in order to receive notification of a UserList event. | |
public | refreshView ( ): Void |
Refresh the UserList view. | |
public | removeEventListener ( type: String, listener: Function ): Void |
Remove a listener from the UserList's event dispatcher, to stop receiving notification of an event. | |
|
A reference to the "ban" Button component. This reference allows you to take control over the ban Button mCOM component, to set its properties (for example size). Please notice that if you change the component size, you have to call the refreshView method to rearrange the UserList's view accordingly. Check the mCOM Flash components documentation for further details. NOTE: this button becomes visible when a Moderator clicks on a user, and only if the enablePrivateChat property is set to
|
|
|
The label of the "ban" button.
|
|
|
The message sent to a user when being banned by the Moderator.
|
|
|
Enable/disable private chat and moderation features. Setting this property to false prevents the private ChatBox and kick/ban buttons to appear when a user is clicked in the list.
|
|
The height of the UserList component on the stage, in pixels. Use this property instead of _height to resize the UserList mantaining the inner components' aspect ratio.
|
|
|
A reference to a custom method to be invoked when attaching the room icon movieclip. Using the iconFunction property, you can set your own user icons by means of a custom function. This function receives an object as parameter (see the labelFunction property for details), and must return a string containing the icon's movieclip linkage name (you must have the icon in your application's library) or a filename of an external icon (only jpg and swf files are supported). If you intend to use an external icon, please read the useSmartList property description.
|
|
|
A reference to the "kick" Button component. This reference allows you to take control over the kick Button mCOM component, to set its properties (for example size). Please notice that if you change the component size, you have to call the refreshView method to rearrange the UserList's view accordingly. Check the mCOM Flash components documentation for further details. NOTE: this button becomes visible when a Moderator clicks on a user, and only if the enablePrivateChat property is set to
|
|
|
The label of the "kick" button.
|
|
|
The message sent to a user when being kicked by the Moderator.
|
|
|
A reference to a custom method to be invoked when rendering the room labels, to set their text. Using the labelFunction property, you can set your own user labels by means of a custom function. This function receives an object as parameter, and must return a string containing the label text. If you use the default renderer for list items, the text can be formatted using html tags supported by the Flash TextField class. The object passed to the function has the following properties:
|
|
|
The space between the list item left border and the label. If the label margin is undefined, the icon width is used as margin. Setting this property is recommended when external swf or jpg files are used for room icons: as loading can take some time, setting a fixed margin prevents the label to be relocated after loading completion.
|
|
A reference to the "moderation module" Label component. This reference allows you to take control over the moderation module Label mCOM component, to set its properties (for example text styling). Please notice that if you change the component size, you have to call the refreshView method to rearrange the UserList's view accordingly. Check the mCOM Flash components documentation for further details. NOTE: this button becomes visible when a Moderator clicks on a user, and only if the enablePrivateChat property is set to
|
|
|
The label text of the moderation module. If left empty, the label doesn't show up in the component.
|
|
|
The color of user label when a private message is received. This property sets the color to which a user label is switched whenever a private message is received and: (1) the private chat module is not visible; (2) the private chat module is visible but the recipient is having a private chat with a different user. When the recipient clicks on the user, the label turns back to the original color.
|
|
A reference to the "private chat" ChatBox component. This reference allows you to take control over the SmartFoxBits' ChatBox component contained inside the UserList, to set its properties. Check the component's documentation for further details. NOTE: this component becomes visible when clicking on a user, and only if the enablePrivateChat property is set to
|
|
|
A reference to the "private chat module" Label component. This reference allows you to take control over the private chat module Label mCOM component, to set its properties (for example text styling). Please notice that if you change the component size, you have to call the refreshView method to rearrange the UserList's view accordingly. Check the mCOM Flash components documentation for further details. NOTE: this label becomes visible when clicking on a user, and only if the enablePrivateChat property is set to
|
|
|
The label text of the private chat module. If left empty, the label doesn't show up in the component.
|
|
|
The height of the list items.
|
|
Show/hide the focus rectangle around the user list, the private ChatBox, and the kick/ban buttons.
|
|
Show/hide the user icons.
|
|
The users' sorting order. List items are ordered by user name (not by label!): set this property to ASC to have an ascending order, or set it to DESC to have a descending order.
|
|
The number of pixels dividing the UserList sub-components (private ChatBox, kick/ban buttons, etc.).
|
|
A reference to the inner AdvancedList component. This reference allows you to take control over the users AdvancedList component, an enhanced version of the List mCOM component, to set its properties (for example text styling). Please notice that changing the component size via ActionScript won't affect the rendering on screen, as the AdvancedList is always resized to match the UserList component size. Check this document for details about the list's RowRenderer.
|
|
|
Enable/disable the "Smart List" feature. When the "Smart List" feature is enabled, only the currently visible list items are rendered. For this reason during list scrolling, each time an item goes out of sight or becomes visible, all the visible items are redrawn. This prevents performance degradation in case of huge number of users, but causes icons flickering in case of externally loaded icons (due to the fact that they are reloaded at each redraw). On the other hand, when this feature is disabled, all the UserList items are rendered, even those out of sight: in case lots of users must be displayed, scrolling may become CPU consuming. If you plan to have many users inside each rooms, it's highly recommended that you enable this feature and use icons contained in the FLA library.
|
|
The width of the UserList component on the stage, in pixels. Use this property instead of _width to resize the UserList mantaining the inner components' aspect ratio.
|
|
|
UserList class constructor. Initializes the component. |
|
Register a listener function in order to receive notification of a UserList event. You can register to events fired by the UserList component, in case you need to be notified to execute your own code. The UserList dispatches the following events: If you no longer need an event listener, remove it by calling the removeEventListener method. NOTE: you should use the
| ||||||
|
|
Refresh the UserList view. If you change the size of the UserList's inner components, you have to call this method to rearrange the UserList's view accordingly. |
|
Remove a listener from the UserList's event dispatcher, to stop receiving notification of an event.
| ||||||
|
The SmartFoxBits' UserList component displays the list of users in a room an allows private messages exchange.
The UserList component shows all user types: standard, guest and moderator. The "guest" users are recognized by the name, which starts with the "guest_" string followed by a progressive number (see the SmartFoxBits' LoginBox component).
When a user in the list is clicked, if the enablePrivateChat property is set to
true
, an inner ChatBox component is displayed for private messaging. If the user clicking on the list is a Moderator, also Kick and Ban buttons are shown.As for all the other SmartFoxBits components, the UserList is based on the mCOM Flash components. You can read more about these components and their features here. Besides working on the mCOM components' styling and skinning features, you can customize the UserList by setting the list items' labels and icons and buttons' labels.
Both user label and icon can be set on the basis of user propeties (see the SmartFoxServer's User class for more informations), so you can set, for example, a specific icon for a user.
By default the component shows different icons depending on the user type. These icons can be easily customized without using the iconFunction property: just add to your application library three movieclips with the linkage property set to:
To display these states properly, the custom icons must have the following structure:
NOTE 1: use the same frame labels (case-sensitive).
NOTE 2: add a
stop()
action in each frame.The UserList component also supports external icon files (swf and jpg formats): check the iconFunction property.