Or you forgot "text1" Anyway, I think it's better to keep your <mx:Script> - tag in the root node, here it's in the <mx:Button> - node
-----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Patrick Mineault Sent: dinsdag 5 december 2006 6:33 To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Function Error You forgot new ArrayCollection somewhere. Patrick jmfillman a écrit : > > 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> > >