2 Replies Latest reply on Sep 15, 2006 3:41 PM by dimival

    What's the deal with the Accordion's headerRender property??

    dimival Level 1
      Accordion components have a property called headerRender which is a ClassFactory object which generates objects of the specified class. By default this ClassFactory creates AccordionHeader objects which are the Accordion's buttons.
      I am trying to use a custom object which extends from AccordionHeader, so the ClassFactory will create these ones instead of the default ones, i am doing this, where Boton extends from AccordionHeader

      <mx:Accordion id="test" width="100%" height="100%" headerRenderer="{new ClassFactory(com.legosoft.mxml.Boton)}">

      Later in my code i need assign some values to one of the Accordion's button (an AccordionHeader) so i am using the getHeaderAt() method, this one returns the button at the specified index of the Accordion, so i try to access the properties of Boton like this:

      test.getHeadertAt(1).property = value

      but the compiler throws an error saying that "property" doesn't exist, so i tried to cast it to Boton like this:

      Boton(test.getHeadertAt(1)).property = value

      this way it does compile but when i access the swf it throws a Cast Exception saying:

      Type Coercion failed: cannot convert mx.containers.accordionClasses::AccordionHeader@5c629e1 to com.legosoft.mxml.Boton

      I now realize this is because when the Accordion is being created it isn't taking the new value that i passed to the headerRender property, it is in fact still creating AccordionHeader objects, so the question is:
      What do i have to do so the Accordion will create Boton objects instead of AccordionHeader objects?