1 Reply Latest reply on Jan 30, 2008 11:02 PM by Gregory Lafrance

    Preventing Accordion from changing currently selected child!?!?

    PawelJ
      Is it possible to prevent changes of currently selected child in Accordion depending on some external conditions?

      Let’s say I have an Accordion with few children and I want to control the possibility of changing the currently selected child. I’m only interested in case when we change current child by clicking on one of the Accordion buttons (headers).

      Is it possible to catch an event generated directly from the control that represents Accordion headers or something like that? It should be possibly first event dispatched right after the click on one of the headers so I could block the changes in the Accordion.

      I’ve already tried sth. like this (but it doesn’t work):
      //…
      private function initApp():void {
      for(var i:uint = 0; i<myAccordion.getChildren().length; i++) {
      var but:Button = myAccordion.getHeaderAt(0);
      but.addEventListener(MouseEvent.CLICK, handleClick);
      }
      }
      private function handleClick(e:MouseEvent):void {
      if(myCondition) {
      e.stopPropagation();
      }
      }
      //...

      Is it possible to remove all the registered event listeners from a Button control used as Accordion header, or maybe replace that Button with my own instance of Button?