0

当调用 popup.open 方法并且没有触发 open 事件时,我遇到了一个问题,我立即使用 popup.close 方法关闭弹出窗口。问题是弹出容器中的内容已创建,但并未完全从舞台上删除,因此我无法单击该按钮。请运行以下代码,请告诉我如何从第二次单击按钮的解决方案。

<?xml version="1.0" encoding="utf-8"?>

<fx:Script>
    <![CDATA[
        import flash.utils.setInterval;

        private var sprCtrl:SpinnerControlWithText;
        private var timer:Timer = new Timer(1);

        protected function button1_clickHandler(event:MouseEvent):void
        {
            sprCtrl = new SpinnerControlWithText();
            sprCtrl.open(this,true);
            sprCtrl.x =0;
            sprCtrl.y = 0;
            sprCtrl.width = this.width;
            sprCtrl.height = this.height;
            sprCtrl.close();//Here i have to close this in backend response
        }

    ]]>
</fx:Script>

<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

<s:Button click="button1_clickHandler(event)" label="Click Me" horizontalCenter="0" verticalCenter="0"/>

<?xml version="1.0" encoding="utf-8"?>      
<s:SkinnablePopUpContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
                               xmlns:s="library://ns.adobe.com/flex/spark"
                               width="100%" height="100%" xmlns:control="control.*" creationComplete="skinnablepopupcontainer1_creationCompleteHandler(event)">
    <fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;

            [Bindable]
            public var msg:String = "Please wait...";
            [Bindable]
            public var colorToSet:uint = 0x000000;

            protected function skinnablepopupcontainer1_creationCompleteHandler(event:FlexEvent):void
            {
                // TODO Auto-generated method stub
                trace("busy cursor creation complete");
            }

        ]]>
    </fx:Script>

    <s:BorderContainer id="spinnerBorderContainer" height="100%" width="100%" backgroundColor="#000000" backgroundAlpha=".5">
        <s:layout>
            <s:VerticalLayout verticalAlign="middle" horizontalAlign="center" />
        </s:layout>
        <s:BorderContainer height="23%" width="32%" backgroundColor="#FFFFFF" backgroundAlpha=".7"> 
        <s:layout>
            <s:VerticalLayout verticalAlign="middle" horizontalAlign="center" />
        </s:layout>
            <!--<control:Spinner id="spinner"  tickColor="{colorToSet}" size="40"  />-->
            <s:BusyIndicator id="spinner" symbolColor="white" rotationInterval="200" />
            <s:Label text="{msg}" fontWeight="normal" textAlign="center" />
        </s:BorderContainer>
    </s:BorderContainer>

</s:SkinnablePopUpContainer>
4

1 回答 1

0

添加 PopUpManager.removePopUp(sprCtrl); 后问题得到解决

sprCtrl.close();//Here i have to close this in backend response
 PopUpManager.removePopUp(sprCtrl);
于 2013-07-13T15:49:09.510 回答