2 Replies Latest reply on Feb 18, 2010 10:47 AM by vividmac87

    Dynamic Accordion Children/Height Issue

    vividmac87

      Hello,

       

      I am fairly new to flex, so this issue may actually be an easy fix, but please bare with me.

       

      I have an accordion in my project that is being populated with child canvas containers based on the result of a mysql_query from AMFPHP. Due to space limitations the accordion MUST remain the exact same size no matter how many records come back from my query. My problem is that when too many accordion child containers are generated they overlap on top of each other.

       

      Screen shot 2010-02-17 at 6.11.26 PM.pngScreen shot 2010-02-17 at 6.08.37 PM.png

       

      Is there a way to turn a scrollbar on for the accordion? If not then is there a way to limit the number of child containers displayed inside the accordion and then control that with a VScrollbar?

       

      Thanks,

      Brian

        • 1. Re: Dynamic Accordion Children/Height Issue
          Gregory Lafrance Level 6

          Wrap the Accordion in a VBox and you should be all set.

           

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
            creationComplete="init();">
            <mx:Script>
              <![CDATA[
                import mx.containers.VBox;
                
                private function init():void{
                  for(var a:uint=0;a<100;a++){
                    var vb:VBox = new VBox();
                    vb.label = "MyVBox" + a;
                    vb.width = 200;
                    vb.height = 100;
                    acc.addChild(vb);
                  }
                }
              ]]>
            </mx:Script>
            <mx:HDividedBox width="100%" height="100%">
              <mx:VBox width="50%" height="100%"/>
              <mx:VDividedBox width="50%" height="100%">
                <mx:VBox width="100%" height="50%"/>
                <mx:VBox width="100%" height="50%">
                  <mx:Accordion id="acc" width="100%" height="50%"/>      
                </mx:VBox>
              </mx:VDividedBox>
            </mx:HDividedBox>
          </mx:Application>
          


          If this post answers your question or helps, please mark it as such.


          Greg Lafrance - Flex 2 and 3 ACE certified

          www.ChikaraDev.com

          Flex / AIR Development, Training, and Support Services

          • 2. Re: Dynamic Accordion Children/Height Issue
            vividmac87 Level 1

            Thanks Greg,

             

            That works perfectly.

             

            -Brian