开发者

Not sure why my program seems to be skipping some functions?

开发者 https://www.devze.com 2023-02-09 19:05 出处:网络
Hey there, I\'m a little confused with some Actionscript I\'m working on. For my GUI, I have written four functions for times when computing is taking place. These are showMessage(\"Loading Text...\")

Hey there, I'm a little confused with some Actionscript I'm working on. For my GUI, I have written four functions for times when computing is taking place. These are showMessage("Loading Text..."), disableButtons(), clearMessage(), and enableButtons(). They work great throughout the program. ShowMessage displays a loading message, disableButtons disables buttons so no one can click anything, clearMessage clears the loading message when job is done, and enableButtons turns them all back on.

For some reason, there is one button click handler which is giving me troubles and I'm not sure why. I've set it up just like others similar to it (which all work) but this one doesn't display the message or shut off my buttons. Here is my clickHandler...

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

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

And here is the creatRbeAC function...

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);         
    }
}

I wasn't getting any loading text, so I took out my clearMessage and enableButtons functions from the code to see if it was adding the message and disabling the buttons to begin with. I am still not getting anything though. Since clearMessage and enableButtons is no where to be found in this button click handler or creatRbeAC function, then I can not understand why the loading message and buttons aren't disabled, even when the computing is finished.

Some things to note. If I comment out the creatRbeAC function, the loading message shows and buttons do disable. Its almost as if those functions are being ignored when the creatRbeAC function is in the code.

Any help? I would greatly appreciate it. Hopefully I have provided 开发者_JS百科enough information.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消