Previous | Next | Frames | No Frames |
Summary: Field | Property | Contructor | Method | Detail: Field | Property | Contructor | Method |
MovieClip | +--it.gotoandplay.smartfoxbits.bits.RoomList
import it.gotoandplay.smartfoxbits.bits.RoomList var roomList_mc:RoomList = RoomList(attachMovie("RoomList", "roomList_mc", 1)) roomList_mc.defaultRoom = "The Garden"
NOTE 1: importing the it.gotoandplay.smartfoxbits.bits.RoomList class and casting the RoomList's movieclip to it is useful if you intend to use a development tool having code-completion features. Otherwise this is enough:
var roomList_mc = attachMovie("RoomList", "roomList_mc", 1)NOTE 2: in the following examples roomList_mc represents the RoomList instance name.
Property Summary | |
public | cancelButton: Button (read-only) |
A reference to the "cancel" Button component. | |
public | defaultRoom: String (read, write) |
The default room to join after a succesful login. | |
public | errorsDisplayTime: Number (read, write) |
The number of seconds error messages must remain visible for. | |
public | errorTextField: TextField (read-only) |
A reference to the error message TextField. | |
public | groupByRoomType: Boolean (read, write) |
Group rooms by type. | |
public | height: Number (read, write) |
The height of the RoomList 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 | joinButton: Button (read-only) |
A reference to the "join"/"play" Button component. | |
public | joinButtonText: String (read, write) |
The label of the "join" button. | |
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 | passwordLabel: Label (read-only) |
A reference to the "password" Label component. | |
public | passwordLabelText: String (read, write) |
The label text of the password input field. | |
public | passwordTextInput: TextInput (read-only) |
A reference to the "password" TextInput component. | |
public | playButtonText: String (read, write) |
The label of the "play" button. | |
public | roomsList: AdvancedList (read-only) |
A reference to the inner AdvancedList component. | |
public | rowHeight: Number (read, write) |
The height of the list items. | |
public | showChatRooms: Boolean (read, write) |
Show/hide the chat rooms inside the list. | |
public | showFocusRectangle: Boolean (read, write) |
Show/hide the focus rectangle around the rooms list, the password input field, and the join/play/watch/cancel buttons. | |
public | showGameRooms: Boolean (read, write) |
Show/hide the game rooms inside the list. | |
public | showIcons: Boolean (read, write) |
Show/hide the room icons. | |
public | showLimboRooms: Boolean (read, write) |
Show/hide the limbo rooms inside the list. | |
public | showPrivateRooms: Boolean (read, write) |
Show/hide the private rooms (independently of their type). | |
public | sortOrder: String (read, write) |
The rooms' sorting order. | |
public | spacing: Number (read, write) |
The number of pixels dividing the RoomList sub-components (password input field, join/play buttons, etc.). | |
public | useSmartList: Boolean (read, write) |
Enable/disable the "Smart List" feature. | |
public | watchButton: Button (read-only) |
A reference to the "watch" Button component. | |
public | watchButtonText: String (read, write) |
The label of the "watch" button. | |
public | width: Number (read, write) |
The width of the RoomList component on the stage, in pixels. | |
Constructor | |
RoomList ( ) | |
RoomList 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 RoomList event. | |
public | refreshView ( ): Void |
Refresh the RoomList view. | |
public | removeEventListener ( type: String, listener: Function ): Void |
Remove a listener from the RoomList's event dispatcher, to stop receiving notification of an event. | |
|
A reference to the "cancel" Button component. This reference allows you to take control over the cancel 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 RoomList's view accordingly. Check the mCOM Flash components documentation for further details. The cancel Button default icon can be customized by adding a custom movieclip with the following linkage property to your application library: it.gotoandplay.smartfoxbits.bits.assets.CancelButtonIcon. NOTE: this button becomes visible when clicking on a private room.
|
|
|
The default room to join after a succesful login. You can both pass the name of the room to join or it's numeric id. If this property is undefined, the component checks if a static server room has the "autoJoin" property set to true and joins it if found.
|
|
|
The number of seconds error messages must remain visible for. If set to 0, error messages (tipically room join errors) won't be displayed.
|
|
A reference to the error message TextField. This reference allows you to take control over the error message TextField, to set its properties (for example text styling). Check the Flash documentation for further details.
|
|
Group rooms by type. Setting this property to true enables the rooms grouping by type: "limbo" rooms appear at the top of the list, followed by chat rooms and game rooms at the bottom. Inside each group rooms are ordered by room name accordingly to the sortOrder parameter.
|
|
|
The height of the RoomList component on the stage, in pixels. Use this property instead of _height to resize the RoomList 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 room icon 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 "join"/"play" Button component. This reference allows you to take control over the join/play 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 RoomList's view accordingly. Check the mCOM Flash components documentation for further details. NOTE: this button becomes visible when clicking on a private room, or a game room accepting spectators. If the room's type is "chat", the button label is set to the joinButtonText property value; in case of "game" room, the label is set to the playButtonText property value.
|
|
|
The label of the "join" button.
|
|
|
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 room 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 "password" Label component. This reference allows you to take control over the password 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 RoomList's view accordingly. Check the mCOM Flash components documentation for further details. NOTE: this label becomes visible when clicking on a private room, and only if the passwordLabelText property is not null.
|
|
|
The label text of the password input field. If left empty, the label doesn't show up in the component.
|
|
|
A reference to the "password" TextInput component. This reference allows you to take control over the password TextInput 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 RoomList's view accordingly. Check the mCOM Flash components documentation for further details. NOTE: this label becomes visible when clicking on a private room.
|
|
|
The label of the "play" button.
|
|
|
A reference to the inner AdvancedList component. This reference allows you to take control over the rooms 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 RoomList component size. Check this document for details about the list's RowRenderer.
|
|
|
The height of the list items.
|
|
Show/hide the chat rooms inside the list.
|
|
|
Show/hide the focus rectangle around the rooms list, the password input field, and the join/play/watch/cancel buttons.
|
|
Show/hide the game rooms inside the list.
|
|
|
Show/hide the room icons.
|
|
Show/hide the limbo rooms inside the list.
|
|
|
Show/hide the private rooms (independently of their type).
|
|
|
The rooms' sorting order. List items are ordered by room name (not by label!): set this property to ASC to have an ascending order, or set it to DESC to have a descending order.If the groupByRoomType property is set to true , the ordering isn't applied to the full list but to the single groups only.
|
|
|
The number of pixels dividing the RoomList sub-components (password input field, join/play buttons, etc.).
|
|
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 rooms, 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 RoomList items are rendered, even those out of sight: in case lots of rooms must be displayed, scrolling may become CPU consuming. If you plan to have many rooms in your application, it's highly recommended that you enable this feature and use icons contained in the FLA library.
|
|
A reference to the "watch" Button component. This reference allows you to take control over the watch 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 RoomList's view accordingly. Check the mCOM Flash components documentation for further details. NOTE: this button becomes visible when clicking on a game room accepting spectators.
|
|
|
The label of the "watch" button.
|
|
|
The width of the RoomList component on the stage, in pixels. Use this property instead of _width to resize the RoomList mantaining the inner components' aspect ratio.
|
|
|
RoomList class constructor. Initializes the component. |
|
Register a listener function in order to receive notification of a RoomList event. You can register to events fired by the RoomList component, in case you need to be notified to execute your own code. The RoomList 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 RoomList view. If you change the size of the RoomList's inner components, you have to call this method to rearrange the RoomList's view accordingly. |
|
Remove a listener from the RoomList's event dispatcher, to stop receiving notification of an event.
| ||||||
|
The SmartFoxBits' RoomList component displays the list of available rooms in the zone, so that users can access them by clicking on a list item.
By default the RoomList component shows all the three available room types (chat, game and "limbo", see Room configuration) and handles password request for private rooms and joining as player/spectator for game rooms.
As for all the other SmartFoxBits components, the RoomList 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 RoomList by setting the list items' labels and icons, grouping rooms by type, setting buttons' labels, showing or hiding specific room types or private rooms.
Both room label and icon can be set on the basis of room propeties (see the SmartFoxServer's Room class for more informations), so you can show, for example, the number of current users/players/spectators, or set a specific icon for the room.
By default the component shows different icons depending on the room type and room being public or private. These icons can be easily customized without using the iconFunction property: just add to your application library five 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 RoomList component also supports external icon files (swf and jpg formats): check the iconFunction property.