Actionscript ReferenceError 1069:Flash试图将函数作为属性调用,我不知道为什么

时间:2013-01-28 15:53:40

标签: actionscript-3 interface referenceerror

我已经编写了一个基本的表单库来模仿ActionScript中的HTML表单,一切都很顺利,直到Flash随机决定我的函数调用不再是一个函数,而是一个属性(或者那些东西。)我有一个IFormElement接口和HiddenElement实现它。验证元素时,FormManager对该元素调用clearValidationErrors(),该元素是接口中定义的函数。当在HiddenElement上发生这种情况时,我收到以下错误:

ReferenceError:错误#1069:属性dls.formmanager.form:在dls.formmanager.form.HiddenElement上找不到IFormElement :: clearValidationErrors,并且没有默认值。

相关代码复制如下:

FormManager

/**
 * helper function to check a single element's validity
 */
public function validateElement(element:IFormElement):Vector.<IValidationError> {
    Debug.out("Validating element " + element.name + " with value " + element.value + "...", Debug.DETAILS, _debugOptions);
    var errors:Vector.<IValidationError> = _formValidator.validateElement(element);

    element.clearValidationErrors();
    if (errors.length > 0) {
        watchElement(element);
        for each (var error:IValidationError in errors) {
            element.addValidationError(error);
        }
    }

    return errors;
}

IFormElement

package dls.formmanager.form {

    import dls.formmanager.validator.errors.IValidationError;

    import org.osflash.signals.Signal;

    public interface IFormElement {

        function get name():String;

        function get value():*;

        function get valueChanged():Signal;

        function get validationRules():Object;

        function addValidationError(error:IValidationError):void;

        function removeValidationError(error:IValidationError):void;

        function clearValidationErrors():void;

    }

}

HiddenElement

package dls.formmanager.form {

    import dls.debugger.Debug;
    import dls.formmanager.form.IFormElement;
    import dls.formmanager.validator.errors.IValidationError;

    import org.osflash.signals.Signal;

    /*
     * This class is used to represent non-interactable items in forms.
     */
    public class HiddenElement implements IFormElement {

        ...

        /**
         * empty function, hidden element will never respond to removing errors
         */
        public function clearValidationErrors():void {

        }

    }

}

0 个答案:

没有答案