Search code examples
apache-flexcustom-componentdataprovider

Flex: Creating a custom list component


I'm trying to extend the mx:Box container so that two buttons sit on the outside of the container to cycle through it's contents (similar to a scrollbar).

I've made a custom component that looks basically like "mx:HBox->mx:Button mx:Box mx:Button" where the buttons and box are children of the hbox.

How do I offer the user access to the box (say its dataProvider and itemRenderer) through my custom component?

So they just need to write 'local:MyCustomComponent dataProvider="rar" itemRenderer="rar"/>' and my box inside that component can use it?


Solution

  • Create getter and setters that proxy the properties of your List component.

    i.e:

    private function set dataProvider(value:Object):void
    {
     list.dataProvider = value;
    }