3 Replies Latest reply on Sep 25, 2010 9:29 PM by celebritymusic

    variable and text question as3

    kerrymckinlay1

      Hi

       

      I have three vars:

       

      var textMessage1 = "Text 1";

      var textMessage2 = "Text 2";

      var textMessage3 = "Text 3";

       

      I have another var which increases it's value by one every time I run through a particular frame:

       

      nextText = 1;

       

       

      I have a text box - textBox - that I want to display "Text 1" if nextText = 1, or "Text 2" if nextText = 2

       

       

      I'm having trouble getting textBox to display what I want (it's formatting and everything else has been set up correctly, as typing textBox.text = "blah"; displays "blah".

       

      This is incorrect, but how do I get it to display - textBox.text = [textMessage+nextText];  ?

       

      I have tried textBox.text = ["textMessage"+nextText]]; but I get told there's a no such variable as textMessage, which is true.

       

      I have tried different versions of the above, but I haven't got it right - any ideas how to?

       

      Thanks

       

      Shaun