1 Reply Latest reply on Oct 23, 2009 9:55 AM by Flex harUI

    Problem with ViewStack selected Index

    kminev

      Hi,

       

      I am having issues selecting the initial index of a view stack. For example I have the following: <mx:ViewStack selectedIndex = 1> and it does not select this index. I think it has something to do with the fact that this particular child is HDividedBox I've had the same issue before in a different app and I just didn't fix it nor found a work-around.

       

      Any ideas.

       

       

      Here is a snipped of my code:

       

      <mx:ViewStack id="vStack"
                            width="100%" height="100%"
                            selectedIndex="1" creationPolicy="all">
                
                <!--VStack.index=0-->
                <mx:VBox id="vBoxSpinner">
                     <ns:Spinner id="spinner" size="50" tickColor="black"/>
                     <mx:Label text="{Global.STR_LOADING}"/>
                </mx:VBox>
                <!--VStack.index=1-->
                <mx:VBox id="vBoxChart" width="100%" height="100%">
                     <mx:HDividedBox id="hDividedBoxBarChart"
                                         resizeToContent="true"
                                          width="100%" height="100%">
                          <mx:ColumnChart id="chartClients"
                                           styleName="MyColumnChart"
                                           width="100%" height="100%"
                                           itemClick="onDgItemClick(event)"
                                          dataProvider="{_fakeData}"
                                          showDataTips="true">
                               <mx:series>
                                    <mx:ColumnSet type="stacked">
                                         <mx:ColumnSeries 
                                                        yField="prodIssues"
                                                          fill="{scProdIssue}"
                                                          stroke="{skProdIssue}"
                                                          displayName="Prod Issues"/>
                                         
                                         <mx:ColumnSeries
                                                        yField="clientMajor_EnhancementRequest"
                                                          fill="{scClntMjrEnh}"
                                                          stroke="{skClntMjrEnh}"
                                                          displayName="Client Major Enhancements"/>
                                         
                                         <mx:ColumnSeries 
                                                        yField="clientMinor_EnhancementRequest"
                                                          fill="{scClntMinorEnh}"
                                                          stroke="{skClntMinorEnh}"
                                                          displayName="Client Minor Enhancements"/>
                                         
                                         <mx:ColumnSeries 
                                                        yField="newClientBuild"
                                                          fill="{scNewClntBuild}"
                                                          stroke="{skNewClntBuild}"
                                                          displayName="New Client Build"/>
                                         
                                         <mx:ColumnSeries 
                                                        yField="internalMajorEnhancement"
                                                          fill="{scIntMjrEnh}"
                                                          stroke="{skIntMjrEnh}"
                                                          displayName="Inernal Major Enhancement"/>
                                         
                                         <mx:ColumnSeries 
                                                        yField="internalMinorEnhancement"
                                                          fill="{scIntMinorEnh}"
                                                          stroke="{skIntMinorEnh}"
                                                          displayName="Inernal Minor Enhancement"/>                 
                                    </mx:ColumnSet>          
           
                               </mx:series>
                               
                               <mx:secondSeries>
                               
                                    <mx:LineSeries id="lnSeriesCaseClosed"
                                                      dataProvider="{_fakeData}"
                                                      displayName="Cases Closed"
                                                      lineStroke="{new Stroke(StrokeColors.DarkOrangeSk.color, 4, _alphaTimesheetData)}"
                                                      yField="casesClosed"
                                                      hideDataEffect="fadeHideDataFx"
                                                      showEffect="fadeShowDataFx"
                                                       />
                                    <mx:LineSeries id="lnSeriesCaseOpen"
                                                      dataProvider="{_fakeData}"
                                                      displayName="Cases Open"
                                                      lineStroke="{new Stroke(StrokeColors.BlueSk.color, 4, _alphaTimesheetData)}"
                                                      yField="casesOpen"
                                                      hideDataEffect="fadeHideDataFx"
                                                      showEffect="fadeShowDataFx"
                                                       />
                               </mx:secondSeries>
                               
                               <mx:verticalAxisRenderers>
                                    <mx:AxisRenderer axisStroke="{StrokeColors.BlueSk}" axis="{vAxisChartClients}"/>
                               </mx:verticalAxisRenderers>     
                               
                               <mx:secondVerticalAxis>
                                    <mx:LinearAxis id="vAxisSecondChartClients" />
                               </mx:secondVerticalAxis> 
                               
                               <mx:secondVerticalAxisRenderer>
                                    <mx:AxisRenderer axis="{vAxisSecondChartClients}" placement="right" axisStroke="{StrokeColors.BlueSk}"/>
                               </mx:secondVerticalAxisRenderer>
                               
                               <mx:horizontalAxisRenderers>
                                    <mx:AxisRenderer axisStroke="{StrokeColors.BlueSk}" labelRotation="45" axis="{hAxisChartClients}"/>
                               </mx:horizontalAxisRenderers>
                               
                               <mx:verticalAxis>
                                    <mx:LinearAxis id="vAxisChartClients" title="# Parent Cases"/>
                               </mx:verticalAxis>
                               
                               <mx:horizontalAxis>
                                    <mx:CategoryAxis categoryField="account" title="Account" id="hAxisChartClients"/>
                               </mx:horizontalAxis>
                          </mx:ColumnChart>
                          
                          <mx:VBox id="vBoxLegeng" paddingTop="10" horizontalScrollPolicy="off" verticalScrollPolicy="off">
                               <mx:HBox id="hBoxTsData">
                                         <mx:CheckBox id="chkCaseClosedOpened" selected="true" click="onChkCaseClosedOpenedCicked(event)"/>
                                         <mx:Label text="Cases - Open/Closed"/>
                                    </mx:HBox>
                               <mx:Legend dataProvider="{chartClients}"/>     
                          </mx:VBox>
                     </mx:HDividedBox>
                </mx:VBox>
                <!--VStack.index=2-->
                <mx:VBox id="vBoxDgChildCases" width="100%" height="100%">
                     <mx:DataGrid width="100%" height="100%" id="dgChildCases"/>
                </mx:VBox>
           </mx:ViewStack>