3 Replies Latest reply on May 4, 2011 9:56 AM by Flex harUI

    Spark List in Actionscript: Passing Layout & itemRenderer in constructor

    Yozef0 Level 1

      I am trying to create a generic List, where I can pass the layout & item renderer as parameters.

      Since it is not possible to pass parameters to a MXML component, I figured I should create my List in Actionscript.

      I figured it would go something like this:

      public class GenericList extends List {
      public function GenericList(iR:ItemRenderer, ac:ArrayCollection, layout:LayoutBase) {
      this.dataProvider = ac;
      this.layout =  ...     // don't even have access to this.layout
      this.itemRenderer = iR // Cannot pass itemRender

      I would prefer to have the List in MXML (because It will be easier using states later), but If I am forced to use pure Actionscript so I can instantiate it and pass in parameters, any help would go a long way.