Flex:模式弹出中不确定的进度条?

发布于 2024-07-17 08:20:00 字数 152 浏览 6 评论 0原文

每当我通过 PopUpManager 在模式弹出窗口中设置不确定的进度条时,就不会显示进度。 如果我定期向父级添加相同的 ProgressBar 或使弹出窗口成为非模式,它就可以工作。 它在模式弹出窗口中不起作用是否有原因? 以及让它发挥作用的方法?

谢谢。

Whenever I set a indeterminate progress bar in a modal pop-up via PopUpManager, there is no progress displayed. If I add the same ProgressBar to the parent regularly or make the pop-up non-modal it works. Is there a reason why it doesn't work in modal pop-ups? and a way to make it work?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

鹿! 2024-07-24 08:20:01

一旦我将 ProgressBar 放入 TitleWindow 中,它就对我有用。 例如,这不起作用:

var waitingpopup:ProgressBar = new ProgressBar();
waitingpopup.indeterminate = true;
waitingpopup.label = "Please wait, loading...";    
PopUpManager.addPopUp(waitingpopup, this, true);

而这起作用了

var waitingpopup:TitleWindow = new TitleWindow();
waitingpopup.title = "Please Wait";
var pb:ProgressBar = new ProgressBar();
pb.indeterminate = true;
pb.label = "Loading...";
waitingpopup.addChild(pb);    
PopUpManager.addPopUp(waitingpopup, this, true);

It worked for me once I put the ProgressBar inside a TitleWindow. For instance, this was not working:

var waitingpopup:ProgressBar = new ProgressBar();
waitingpopup.indeterminate = true;
waitingpopup.label = "Please wait, loading...";    
PopUpManager.addPopUp(waitingpopup, this, true);

And this worked

var waitingpopup:TitleWindow = new TitleWindow();
waitingpopup.title = "Please Wait";
var pb:ProgressBar = new ProgressBar();
pb.indeterminate = true;
pb.label = "Loading...";
waitingpopup.addChild(pb);    
PopUpManager.addPopUp(waitingpopup, this, true);
獨角戲 2024-07-24 08:20:00

我已经让其他一些开发人员看到了这个,事实证明这是一个错误,但有一个解决方法。我将发布我的原始代码,然后发布解决方法的更改代码:

原始:

private function showLoading(e:Event = null):void
            {
                if(_progBar == null)
                {
                    _progBar = new ProgressBar();
                    _progBar.width = 200;
                    _progBar.indeterminate = true;
                    _progBar.labelPlacement = 'center';
                    _progBar.setStyle("removedEffect", fade);
                    _progBar.setStyle("addedEffect", fade);
                    _progBar.setStyle("color", 0xFFFFFF);
                    _progBar.setStyle("borderColor", 0x000000);
                    _progBar.setStyle("barColor", 0xf4b60f);
                    _progBar.label = "";
                }
                PopUpManager.addPopUp(_progBar,this,true);
                PopUpManager.centerPopUp(_progBar);
            }

解决方法:

private function showLoading(e:Event = null):void
            {
                if(_progBar == null)
                {
                    _progBar = new ProgressBar();
                    _progBar.width = 200;
                    _progBar.indeterminate = true;
                    _progBar.labelPlacement = 'center';
                    _progBar.setStyle("removedEffect", fade);
                    _progBar.setStyle("addedEffect", fade);
                    _progBar.setStyle("color", 0xFFFFFF);
                    _progBar.setStyle("borderColor", 0x000000);
                    _progBar.setStyle("barColor", 0xf4b60f);
                    _progBar.label = "";
                    _progBar.mode = ProgressBarMode.MANUAL;
                }
                PopUpManager.addPopUp(_progBar,this,true);
                PopUpManager.centerPopUp(_progBar);
                 _progBar.setProgress(0, 0);
            }

I have had some other developers look at this, it turns out it is a bug, but there is a work around..I'll post my original code and then the altered code for the work around:

original:

private function showLoading(e:Event = null):void
            {
                if(_progBar == null)
                {
                    _progBar = new ProgressBar();
                    _progBar.width = 200;
                    _progBar.indeterminate = true;
                    _progBar.labelPlacement = 'center';
                    _progBar.setStyle("removedEffect", fade);
                    _progBar.setStyle("addedEffect", fade);
                    _progBar.setStyle("color", 0xFFFFFF);
                    _progBar.setStyle("borderColor", 0x000000);
                    _progBar.setStyle("barColor", 0xf4b60f);
                    _progBar.label = "";
                }
                PopUpManager.addPopUp(_progBar,this,true);
                PopUpManager.centerPopUp(_progBar);
            }

work around:

private function showLoading(e:Event = null):void
            {
                if(_progBar == null)
                {
                    _progBar = new ProgressBar();
                    _progBar.width = 200;
                    _progBar.indeterminate = true;
                    _progBar.labelPlacement = 'center';
                    _progBar.setStyle("removedEffect", fade);
                    _progBar.setStyle("addedEffect", fade);
                    _progBar.setStyle("color", 0xFFFFFF);
                    _progBar.setStyle("borderColor", 0x000000);
                    _progBar.setStyle("barColor", 0xf4b60f);
                    _progBar.label = "";
                    _progBar.mode = ProgressBarMode.MANUAL;
                }
                PopUpManager.addPopUp(_progBar,this,true);
                PopUpManager.centerPopUp(_progBar);
                 _progBar.setProgress(0, 0);
            }
蹲墙角沉默 2024-07-24 08:20:00

我们可以通过使用containter.addChild(Pg)eg.Canvas来做到这一点,然后使用PopUpManager。

We can do this by using containter.addChild(Pg) eg.Canvas and then use PopUpManager.

醉南桥 2024-07-24 08:20:00

我遇到了同样的问题,但其他解决方案都没有帮助。 下面是为我产生问题的代码:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" applicationComplete="applicationComplete();">
    <mx:Script><![CDATA[
        import mx.controls.ProgressBar;
        import mx.managers.PopUpManager;
        private function applicationComplete():void
        {
            var progressBar:ProgressBar = new ProgressBar()
            progressBar.indeterminate = true;
            PopUpManager.addPopUp(progressBar, this, true);
            //this.addChild(progressBar);           including this line overrides the popup
            //progressBar.setProgress(0, 0);        including this line makes no difference
        }
    ]]></mx:Script>
    <mx:Label text="hello"/>
</mx:Application>

这两行注释掉的行是我理解的其他建议的解决方案。 我设法使用下面的尴尬解决方法解决了这个问题:

步骤 1:创建自定义 mxml 组件,另存为 Progress.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:ProgressBar indeterminate="true" />
</mx:TitleWindow>

步骤 2:在代码中使用自定义组件

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" applicationComplete="applicationComplete();">
    <mx:Script><![CDATA[
        import mx.controls.ProgressBar;
        import mx.managers.PopUpManager;
        import Progress;
        private function applicationComplete():void
        {
            var progress:Progress =  new Progress();
            PopUpManager.addPopUp(progress, this, true);
            PopUpManager.centerPopUp(progress);
        }
    ]]></mx:Script>
    <mx:Label text="hello"/>
</mx:Application>

似乎将 ProgressBar 放入 TitleWindow 中很重要。

I had the same problem, but neither of the other solutions helped. Below is the code that produces the problem for me:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" applicationComplete="applicationComplete();">
    <mx:Script><![CDATA[
        import mx.controls.ProgressBar;
        import mx.managers.PopUpManager;
        private function applicationComplete():void
        {
            var progressBar:ProgressBar = new ProgressBar()
            progressBar.indeterminate = true;
            PopUpManager.addPopUp(progressBar, this, true);
            //this.addChild(progressBar);           including this line overrides the popup
            //progressBar.setProgress(0, 0);        including this line makes no difference
        }
    ]]></mx:Script>
    <mx:Label text="hello"/>
</mx:Application>

The two commented out lines are what I understood to be the other suggested solutions. I managed to fix this using the awkward workaround below:

Step 1: Create custom mxml component, saved as Progress.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:ProgressBar indeterminate="true" />
</mx:TitleWindow>

Step 2: Use custom component in code

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" applicationComplete="applicationComplete();">
    <mx:Script><![CDATA[
        import mx.controls.ProgressBar;
        import mx.managers.PopUpManager;
        import Progress;
        private function applicationComplete():void
        {
            var progress:Progress =  new Progress();
            PopUpManager.addPopUp(progress, this, true);
            PopUpManager.centerPopUp(progress);
        }
    ]]></mx:Script>
    <mx:Label text="hello"/>
</mx:Application>

It seems that putting the ProgressBar inside the TitleWindow is important.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文