PDA

View Full Version : List of custom components


d000hg
03-07-2008, 12:29 PM
I want to create a list containing details of servers available for an online game... I'm thinking I want a custom component which displays name, number of people logged in, etc.
My understanding is that any custom component derived from UIComponent can be used in a standard mx.controls.List?

The thing I'm confused about is if I should actually be adding these items one by one, or if I should store them in a collection (array, etc) and set this as the data provider of the List object. I don't really follow data providers and data binding very well, as I'm coming from a Java/C++ background.

One important point is that the list of servers will be refreshed regularly, for what difference this makes.

Thanks for any help.

Daedalus
03-07-2008, 08:15 PM
I dont think you really need to build a custom component just for displaying game server info. Using the datagrid (or advanced datagrid (flex 3) http://livedocs.adobe.com/labs/flex3/langref/mx/controls/AdvancedDataGrid.html) will probably be what you need.

I havent used the current version of the datagrid yet but dataprovider is the way to go. If your game server info is loaded from the server in XML format your sorted, as you can just specify the xml object as the dataProvider and it will lay it out for you.

(see the example section in the class Doc)