Your validateForm() function tries to call a method on a variable
which is null. I'm not sure exactly where you have gone wrong as
your example code is incomplete. Set a break point in the validateForm
() function and run it in the debugger so you can which line throws
the error.
Cheers,
Lach
On 05/12/2006, at 11:59 AM, jmfillman wrote:
When I click on the Submit button, I get the following error:
"TypeError: Error #1009: Cannot acces a property or method of a null
object reference.
at main/validateForm()
at main/__btnFormSign_click()"
What am I doing wrong?
<mx: State name="Forms">
<mx:AddChild position="lastChild">
<mx:Canvas width="200" height="31" right="10" top="39">
<mx:Button label="Submit" id="btnFormSign" click="validateForm();">
<mx:Script>
<![CDATA[
[Bindable]
public var validationAC:ArrayCollection;
public function validateForm() :void {
if (text1.text.length < 3) {
validationAC.addItem({label:"Text1", data:false});
}
}
</mx:Script>
</mx:Button>
</mx:Canvas>