1 Reply Latest reply on Jul 29, 2011 4:46 PM by cdsvvxv

    Label.text and null object reference

    cdsvvxv Level 1

      I have the following code:

       

      <fx:Script>
              <![CDATA[
           
                  [EventHandler(event="EventLogin.LOGIN_SUCCESS")]
                  public function showLoginMessage(event:EventLogin):void {
                      labelLoginMessage.text = "Hello world";
                  }
                 
              ]]>
          </fx:Script>

       

          <s:Label id="labelLoginMessage" fontWeight="bold" visible="false" text="hello" />

       

      When the call to set labelLoginMessage is made, I get:

       

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

       

      It seems that the label is not created at the time the event is received. Why is this and how do I work around it?

       

       

      On a side note, the forum software is not very good. I have trouble logging in, where I get sent back to the login page wthout any error message. When I have logged in, the forum page does not recognise that I am logged in, and when I post a message I always loose the first submit I made and have to re-write everything. Is it just me or is the forum software piss poor? Why not just just PhpBB or other proven forum software? Why are there no code or quote tags? I am not surprised there are so few posts - can anyone recommend a better flex programmers forum please?