You add child components which are UIComponents to a container like HBox.

But you add data items to a list-based control like HorizontalList. These data 
items then get displayed by item renderers, which are children which get 
automatically created to display data items. The children are managed by the 
list, not by you... you manage the data, not the renderers.

By default, data items are expected to have a 'label' property to display, 
unless you set the labelField or labelFunction of the list component. They can 
be plain Objects, or  instances of data classes, or anything else, but  
typically they aren't visual components.

Here's an example of adding two data items to a list using ActionScript.

    myList.dataProvider = new ArrayCollection();
    var item:Object;
    item = { label: "One", data: 1 };
    myList.dataProvider.addItem(item);
    item = { label: "Two", data: 2 };
    myList.dataProvider.addItem(item);

Gordon Smith
Adobe Flex SDK Team

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of veena_kris2003
Sent: Friday, July 24, 2009 3:19 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Question about a flex component



Please help. The items are being added dynamically to the <mx:HorizontalList 
id="test" bottom="0" width="100%"
backgroundColor="0x000000" horizontalScrollPolicy="on"
verticalScrollPolicy="off"/> I debugged the code and the
items are being added, but I can't see them in the UI.
If I change mx:HorizontalList to mx:HBox I can see the items
in the UI. What am I doing wrong?

--- In flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>, Gordon 
Smith <gosm...@...> wrote:
>
> No, I don't have an example and don't have time to create one for you since 
> I'm a development engineer, not a support engineer. But here is what you 
> should try, learning as you go:
>
> 1. Create an app with an <mx:HorizontalList>.
> 2. Make it show data items by assigning its dataProvider. Put in more data 
> items that will fit.
> 3. Turn off its scrollbar by setting horizontalScrollPolicy="off".
> 4. Create <mx:Button>s for "Previous" and "Next", positioned to the left and 
> right of the HorizontalList.
> 5. In their 'click' handlers, put code like 
> horizontalList.horizontalScrollPosition += 1. Use -= for the Previous button.
>
> Gordon Smith
> Adobe Flex SDK Team
>
> From: flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com> 
> [mailto:flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>] On 
> Behalf Of veena_kris2003
> Sent: Thursday, July 23, 2009 4:42 PM
> To: flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>
> Subject: [flexcoders] Re: Question about a flex component
>
>
>
> Do you mind posting an example. It sounds like this is what I was looking 
> for. I need a horizontal list component with an icon at the right end of the 
> component that I can click and scroll to more items.
>
> Thanks,
>
> Veena
>
> --- In 
> flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>,
>  Gordon Smith <gosmith@> wrote:
> >
> > Why not just allow scrolling instead of paging? Scrolling components can 
> > scroll through thousands of items quickly.
> >
> > Suppose there are 100 items and you can only see 10 at a time. So first you 
> > see 0-9. When you click the icon you see 10-19. When you click it again 
> > you'd see 20-29. So you'd need another icon ("previous page" instead of 
> > "next page") to go back to 10-19 and then 0-9.
> >
> > Gordon Smith
> > Adobe Flex SDK Team
> >
> > From: 
> > flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>
> >  
> > [mailto:flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>]
> >  On Behalf Of veena pandit
> > Sent: Thursday, July 23, 2009 10:22 AM
> > To: 
> > flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders%40yahoogroups.com>
> > Subject: [flexcoders] Question about a flex component
> >
> >
> > Hi,
> >
> > I am new to Flex. I am looking for help on designing a custom component 
> > that will
> > hold a lot of items. When the items exceed the number that are visible in 
> > the ui
> > of this horizontal component on the webpage an icon appears, which if you 
> > click
> > will show a list of the other components you can click again and restore 
> > the ui with
> > that item. Hope you understand what I am talking about. If not please post 
> > for clarification.
> >
> > Thanks in advance,
> >
> > Veena
> >
>

Reply via email to