2013-03-02 92 views
0

我正在使用Flex builder 4.5。我在我的web应用程序中有五个组合。 组合1作为员工和学生加载。 组合2加载部门, 组合3加载员工姓名, 组合4加载学生批量和 组合5分别加载学生名称。更改组合框时动态移动组合框?

当我在第一个组合中选择学生时,组合4和组合5应该动态上移。请告知此...

回答

0

操纵控制坐标不是一个好习惯。代替它,我会使用ViewStack控件,并根据第一个组合的项目更改选定的索引。

因此,您可以更好地控制视图表示,减少未来更改的问题。

<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
      xmlns:s="library://ns.adobe.com/flex/spark" 
      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"> 

<s:VGroup x="10" y="10"> 
    <s:ComboBox id="cbMain" selectedIndex="0"> 
     <s:ArrayList> 
      <fx:Object label="Staff"/> 
      <fx:Object label="Student"/> 
     </s:ArrayList> 
    </s:ComboBox> 

    <mx:ViewStack id="vsMain" width="200" height="200" selectedIndex="{cbMain.selectedIndex}"> 
     <s:NavigatorContent id="ncStaff" width="100%" height="100%"> 

      <s:VGroup> 
       <s:ComboBox id="cbStaffDep" selectedIndex="0"> 
        <s:ArrayList> 
         <fx:Object label="Department01"/> 
         <fx:Object label="Department02"/> 
        </s:ArrayList> 
       </s:ComboBox> 

       <s:ComboBox id="cbStaffName" selectedIndex="0"> 
        <s:ArrayList> 
         <fx:Object label="StaffName01"/> 
         <fx:Object label="StaffName02"/> 
        </s:ArrayList> 
       </s:ComboBox> 
      </s:VGroup> 
     </s:NavigatorContent> 

     <s:NavigatorContent id="ncStudent" width="100%" height="100%"> 

      <s:VGroup> 
       <s:ComboBox id="cbStudentBatch" selectedIndex="0"> 
        <s:ArrayList> 
         <fx:Object label="Batch01"/> 
         <fx:Object label="Batch02"/> 
        </s:ArrayList> 
       </s:ComboBox> 

       <s:ComboBox id="cbStudentName" selectedIndex="0"> 
        <s:ArrayList> 
         <fx:Object label="StudentName01"/> 
         <fx:Object label="StudentName02"/> 
        </s:ArrayList> 
       </s:ComboBox> 
      </s:VGroup> 

     </s:NavigatorContent> 
    </mx:ViewStack> 

</s:VGroup> 

</s:Application>