2012-09-20 85 views
0

我用驗證器創建了一個表單。每次代碼運行到與label.text相關的label.text或函數時,都會彈出以下錯誤消息。以下錯誤是否意味着驗證器有錯誤或label.text的默認值是錯誤的?代碼中的未知錯誤


ReferenceError: Error #1069: Property Text not found on spark.components.TextInput and there is no default value. 
    at mx.validators::Validator/getValueFromSource()[E:\dev\4.y\frameworks\projects\framework\src\mx\validators\Validator.as:980] 
    at mx.validators::Validator/validate()[E:\dev\4.y\frameworks\projects\framework\src\mx\validators\Validator.as:940] 
    at mx.validators::Validator/triggerHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\validators\Validator.as:1167] 
    at flash.events::EventDispatcher/dispatchEventFunction() 
    at flash.events::EventDispatcher/dispatchEvent() 
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152] 
    at spark.components.supportClasses::SkinnableTextBase/textDisplay_valueCommitHandler()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableTextBase.as:2743] 
    at flash.events::EventDispatcher/dispatchEventFunction() 
    at flash.events::EventDispatcher/dispatchEvent() 
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152] 
    at spark.components::RichEditableText/set text()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\RichEditableText.as:2115] 
    at spark.components.supportClasses::SkinnableTextBase/set text()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableTextBase.as:1400] 
    at spark.components::TextInput/set text()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\TextInput.as:280] 
    at productDetailComp/onNew()[C:\Users\School\Adobe Flash Builder 4.6\FYPadminSideV3\src\productDetailComp.mxml:44] 
    at productDetailComp/__newBut_click()[C:\Users\School\Adobe Flash Builder 4.6\FYPadminSideV3\src\productDetailComp.mxml:314] 

回答

1

請注意,錯誤說屬性 「文本」(用大寫字母T)未找到。 TextInput有一個小寫「t」的text屬性。

聽起來好像你已經配置了Validator來驗證不正確的屬性名稱。也就是說,你這樣做是:

<mx:Validator source="{myTextInput} property="Text" /> 

當它應該是這樣的:

<mx:Validator source="{myTextInput} property="text" /> 
+0

運行後完美我將其更改爲小寫。 – Samuel

+0

和許多感謝解釋。 – Samuel

相關問題