0

嘿,我对我正在处理的一些 Actionscript 有点困惑。对于我的 GUI,我编写了四个用于计算发生时的函数。它们是 showMessage("Loading Text...")、disableButtons()、clearMessage() 和 enableButtons()。他们在整个计划中工作得很好。ShowMessage 显示加载消息,disableButtons 禁用按钮,因此没有人可以单击任何内容,clearMessage 在工作完成时清除加载消息,并且 enableButtons 将它们全部重新打开。

出于某种原因,有一个按钮单击处理程序给我带来了麻烦,我不知道为什么。我已经设置了它,就像其他类似的一样(所有工作),但这个不显示消息或关闭我的按钮。这是我的clickHandler ...

private function Buffer_Route_clickHandler():void
        {
            showMessage("Loading RBE Options");
            disableButtons();

            if(Buffer_Route.selected && rbeAC.length == 0){
                createRbeAC();
            }
        }

这是 creatRbeAC 函数...

private function createRbeAC():void
{               
    rbeAC.removeAll();
    hiddenRBELayers.removeAll();

    var rbeIDs:Array = rbeConfigList.getKeySet();
    for each (var rbeID:int in rbeIDs)
    {   
            var rbeConfig:Hashtable = rbeConfigList.find(rbeID) as Hashtable;
        var rbeData:Object = 
        {
            restURL:rbeConfig.find("rbeRESTURL") as String,
            layername:rbeConfig.find("rbeLayerName") as String,
            icon: rbeConfig.find("rbeIcon") as String, 
            titlefield: rbeConfig.find("rbeTitleField") as String,
            checked: rbeConfig.find("rbeChecked") as String,
            count: "0" as String
        };                  
        if(rbeData.checked == "false")
        {                   
            hiddenRBELayers.addItem(rbeData.layername);// as String);
        }
        rbeAC.addItem(rbeData);         
    }
}

我没有收到任何加载文本,所以我从代码中取出了 clearMessage 和 enableButtons 函数,看看它是否正在添加消息并禁用按钮。我仍然没有得到任何东西。由于在此按钮单击处理程序或 creatRbeAC 函数中找不到 clearMessage 和 enableButtons ,因此即使计算完成,我也无法理解为什么加载消息和按钮未被禁用。

有些事情要注意。如果我注释掉 creatRbeAC 函数,则会显示加载消息并且按钮会禁用。当 creatRbeAC 函数在代码中时,就好像这些函数被忽略了。

有什么帮助吗?我将不胜感激。希望我提供了足够的信息。

4

1 回答 1

0

in my actual app, i have similiar problems. In my Eventhandler (it doesn't matter, if there is a button handler or a mouse handler), I also wan't to disable the app and use some filter functions for my arrayCollection.

Unfortunately, this action seems to need too much ressources, especialy, when the app run in debug mode. I have to waint for the next screnn refresh. So i try to implement the "applyFilterMethod" in my eventhandler with

callLater(applyFilterMethod)

but it also wo't work.

Finally, the setTimeOut(applyFilterMethod,500)

solved my issue. So, try it with the timeout-method, if you have luck.

BR Frank

于 2011-02-10T08:37:20.947 回答