在标题栏中移动组件?

时间:2015-01-06 15:59:15

标签: actionscript-3 flex air flex4

我有一个桌面应用程序,它使用WindowedApplication和标题栏中的几个DropDownLists。我需要将DropDownLists移动到右侧,但似乎无法弄清楚如何。项目的设置方式是WindowedApplication实际上是spark WinowedApplication类的扩展,所以一切都在动作脚本文件中,而不是mxml文件。我已经被投入了Flew项目的工作,所以我不允许对代码过于具体。对不起,如果这还不够,我对Flex来说很新。

1 个答案:

答案 0 :(得分:1)

将所有下拉列表放在HGroup容器中,并将HGroup的horizo​​ntalAlign设置为" right"

解决方案1:使用mxml(将此hgroup添加到工具栏中)

<s:HGroup id="dropDownListsContainer" width="100%" height="20" horizontalAlign="right" verticalAlign="middle">
  <!-- add your dropdownlists here-->
    <s:DropDownList id="dropDownList1"/>
    <s:DropDownList id="dropDownList2"/>
    <s:DropDownList id="dropDownList3"/>
    <s:DropDownList id="dropDownList4"/>
</s:HGroup>

解决方案2:使用AS3

    var dropDownListsContainer:HGroup = new HGroup();
    dropDownListsContainer.horizontalAlign = HorizontalAlign.RIGHT;
    //Add your dropDownLists to the Hgroup
    dropDownListsContainer.addElement(dropDownList1);
    dropDownListsContainer.addElement(dropDownList2);
    dropDownListsContainer.addElement(dropDownList3);
    dropDownListsContainer.addElement(dropDownList4);
    //Add your HGroup to your toolbar "myToolbar"
    myToolbar.addElement(dropDownListsContainer);