0 Replies Latest reply on Apr 23, 2010 8:26 AM by sd55

    Control multiple accordions with a single control?

    sd55

      I want to control a the selectedIndex of a number of different accordions from a single control (e.g. a VSlider).

       

      Using the example at http://blog.flexexamples.com/2007/09/17/programmatically-changing-a-flex-accordion-contain ers-selected-index/, I've got a single VSlider controlling a single accordion ("mainhaccordiona"), using the code below. I'd like to control four accordions (mainhaccordiona, mainhaccordionb, mainhaccordionc, and mainhaccordiond) from the single VSlider.

       

      My ultimate goal is to set up both a "reset" function (open all panels at selectedIndex = 0) and also a randomizer (each selectedIndex is set to a random value within each accordion's range).

       

      Does anyone have any tips or is there an example already out there on the web that I've missed?

       

      Thanks!

       

      Scott

      =====

       

      private function init():void

      {

      slider.maximum = mainhaccordiona.numChildren -1;

      slider.labels = [0, slider.maximum];

      }

       

      private function dataTipFunc(item:Object):String

      {

      return "selectedIndex = " + item.toString();

      }

      ...

                <mx:ApplicationControlBar dock="true" fontSize="8">

      <mx:VSlider id="slider"

                      minimum="0"

                      liveDragging="true"

                      snapInterval="1"

                      tickInterval="1"

                      change="mainhaccordiona.selectedIndex = event.value;"

                      dataTipFormatFunction="dataTipFunc"

                      dataTipPlacement="bottom" />

      </mx:ApplicationControlBar>