在FlashDevelop中编译错误

时间:2013-06-02 21:35:28

标签: actionscript-3 actionscript-2 flashdevelop

我有用ActionScript 3编写的代码:

private function _initializeUI() {
        function onClick(e : Event) {
            var checkBox : CheckBox = CheckBox(e.target);
            Chat.sendToClient("checkBox pressed : " + checkBox.name);
            switch(checkBox.name) {
                case "autoHealCheckBox":
                    checkBox.checked = !checkBox.checked;
                    _settings.walle.autoHeal = checkBox.checked;
                    break;
                case "autoOffCheckBox":
                    checkBox.checked = !checkBox.checked;
                    _settings.walle.autoOff = checkBox.checked;
                    break;
                case "autoBattleCheckBox":
                    checkBox.checked = !checkBox.checked;
                    _settings.walle.autoBattle = checkBox.checked;
                    break;
                case "debugCheckBox":
                    checkBox.checked = !checkBox.checked;
                    _settings.walle.debug = checkBox.checked;
                    break;
                case "onOffCheckBox":
                    checkBox.checked = !checkBox.checked;
                    if (checkBox.checked) {
                        this.start();
                    } else {
                        this.stop();
                    }
                    break;
                default:
                    if (checkBox.name.substr(0, 6) == "PickUp") {
                        checkBox.checked = !checkBox.checked;
                        var k : String = checkBox.name.substr(6).split('_').join(' ');
                        _settings.walle.pickup[k] = checkBox.checked;
                    }
                    break;
            };
        }

当我编译FlashDevelop时说

src/walle/Walle.as:113: characters 11-18 : parse error Unexpected onClick

我该怎么办?

1 个答案:

答案 0 :(得分:0)

Actionscript 3 不承认嵌套函数。如果您使用 AS2 ,请确保使用正确的配置设置项目。