2 Replies Latest reply on Apr 11, 2017 6:43 AM by RiddleDigital

    If statements with dynamic text


      Hello there,


      I have ran into a simple problem, I haven't written script in years, but now need to show a younger generation the possibilities of creating interactive stuff


      So, my problem is that I have made two buttons and a dynamic text, where if the user presses the button the dynamic text counter goes up till the number 2.


      However, I can't seem to write a if statement, that if the counter reaches 2, to go and play a certain scene


      Here is what I got


      if (this.clickcounter.text >= 2) {




      I get an error that "Uncaught TypeError: Cannot read property 'text' of undefined", even tho I have defined my dynamic text (this.clickscounter.text = 0;), and the counter works fine, when I remove the if statement no errors in the console! :/ I tried to convert AS3 code I had back in the days, but with no success. So, hopefully someone will be able to help me much appreciated