0

我有以下选项卡导航器,它有一个项目选项卡,在发布标签旁边包含一个组合框,如下所示(AdditionalDetails.mxml)在此处输入图像描述

相同的选项卡导航器有一个Gate2选项卡,其中包含标签CERT 加载日期旁边的DateField,可以在下面看到(Gate2.mxml): 在此处输入图像描述

现在,当我在Project选项卡上选择Release as TBD时,会出现一个警告框,如下所示: 在此处输入图像描述

单击YES时,我想清除Gate2选项卡上的DateField 。我该怎么做?组合框代码(AdditionalDetails.mxml):

<mx:ComboBox id="General_Release_Dates"
                     selectedItem="{modelProxy.General_Release_Dates}"
                     valueCommit="{model.General_Release_Dates = event.currentTarget.selectedItem;updateReleaseDate(event)}"
                     change="{model.General_Release_Dates = event.currentTarget.selectedItem;updateReleaseDate(event)}" close="closeHandler(event);" includeInLayout="true" visible="true">
        </mx:ComboBox

处理YES的代码点击Alert框:

private function alertClickHandler(evt:CloseEvent):void {
if (evt.detail == Alert.YES) { //Code to clear DateField}

Gate2选项卡上的DateField代码( Gate2.mxml ): DateField 代码:<mx:DateField id="G2_CRTLoadDate" width="150" selectedDate="{modelProxy.G2_CRTLoadDate}" change="{modelProxy.G2_CRTLoadDate = event.currentTarget.selectedDate;changeManagerStatus()}"/>

4

1 回答 1

1

更新时间:8 月 31 日 23:27(JST)

如果您使用单例 Flex - 在另一个 mxml 页面上访问静态变量时出现问题

1)在您的 MySingleton 类中创建变量,如下所示。

    private var _gate2:Object;

    public function set gate2(value:Object):void
    {
        _gate2 = value;
    } 

    public function get gate2():Object
    {
        return _gate2; 
    }

2)Gate2.mxml(写在creationComplete事件中)

singleton.gate2 = this;

3) 从外部类控制 Gate2。

private function alertClickHandler(evt:CloseEvent):void {
    if (evt.detail == Alert.YES) {
        //Code to clear DateField

        singleton.gate2.G2_CRTLoadDate.selectedDate = null;
    }
}
于 2015-08-31T11:40:39.700 回答