1 Reply Latest reply on Jan 28, 2010 10:53 AM by Gregory Lafrance

    TypeError

    minetgate

      hi, me again,

       

      I have a problem when I try to set the text property of TextInput control because sends me the following error:

       

      Error #1009: Cannot access a property or method of a null object reference.

       

      the routine is the following:

       

      private function alertClickHandler(event:CloseEvent):void
        {
                      if (event.detail==Alert.YES)
                      {
                           //  UnlockComponents();   
                           try
                           {
                   //          newInvoice.send();
                             txtImpuesto.text = '0.00';
                             txtTotal.text    = '0.00';
                             txtItems.text    = '0.00';
                             txtFacturaNo.text = '';
                             txtNCF.text      = '';
                             txtRNC.text      = '';
                             txtBanco.text    = '';
                             txtCambio.text   = '0.00';
                             txtChequeNo.text = '';
                             txtEfectivo.text = '0.00';
                             txtEmail.text    = '';
                             txtExcento.text  = '0.00';
                             txtFecha.text    = '';
                             txtTotal.text    = '0.00';
                             txtTelefono.text = '';
                     //        grdDetalle.dataProvider = null;
                           }
                           catch(err:Error)
                           {
                               Alert.show(err.message,"ERROR");
                           }
                      }
                     
           }

       

       

      private function nueva():void
        {
                  Alert.yesLabel = "Si";
                  Alert.noLabel = "No";
                  Alert.show("Seguro que desea cancelar la operación en curso?", "ADVERTENCIA", 3, this, alertClickHandler);
                      
        }

       

      when I call the nueva() function trigg the error.

       

      please help.

        • 1. Re: TypeError
          Gregory Lafrance Level 6

          Exactly which line of code is causing the error? Has the TextInput been instantiated, either because it was created with an MXML tag or in ActionScript?

           

          I see you are doing a send(). If that is to get data, don't forget Flex is asynchronous, so you can't call send() and assume is loaded already, because chances are it is not. This means sometimes you need to call functions in the result handler method.

           

          If this post answers your question or helps, please mark it as such.


          Greg Lafrance - Flex 2 and 3 ACE certified

          www.ChikaraDev.com

          Flex / AIR Development, Training, and Support Services