Skip to main content
Known Participant
October 15, 2024
Question

Why my variable is not changed

  • October 15, 2024
  • 3 replies
  • 2962 views

Hello,

 

I have a variable myQuestion but it doesn't display. What problem can be?

 

 

    This topic has been closed for replies.

    3 replies

    JoãoCésar17023019
    Inspiring
    October 17, 2024

    Thanks for the file.

     

    Even though there are a couple of issues, it worked for me.

     

    But, anyway, you can fix at least the issues below.

    It should be this.gotoAndStop(1);. In the HTML5 Canvas document, the first frame is 0, then 1, 2, and so on.


    There's no myQuestion text field in the second frame of the main timeline. This text field is inside of another symbol. So you should either remove line 4 - as you also have the same instruction inside of the forementioned symbol - or give a name to this symbol in which you have the text field and change the reference. For example: this.sealAnim.myQuestion.text = "Hello";. // sealAnim would be the name of the Movie Clip that contains the seal animation.

    Known Participant
    October 17, 2024

    I removed it from the Frame 2 because it didn't work, so that's why I created it in seal layer. There it works. I want it on the main scene as i feel that in future I will have a problem with the button to go to the main scene from seal layer. I allow you to add text to the main scene to test.

    Also I have a problem with animation in html - https://community.adobe.com/t5/animate-discussions/why-i-don-t-see-my-hero/m-p/14913266#M378615 . Could you test it?

    JoãoCésar17023019
    Inspiring
    October 16, 2024

    Hi.

     

    What do you get if you run console.log(this.myQuestion); on frame 0 and 1 from the main timeline?

    Regards,

    JC

    Known Participant
    October 16, 2024

    Hi, the variables are not seen

     

    kglad
    Braniac
    October 16, 2024

    same problem, same answer.

     

    will fix your fla when i ger to a computer.

    Known Participant
    October 15, 2024

    the variable is not changed during the test, too

    Known Participant
    October 15, 2024

      

    kglad
    Braniac
    October 15, 2024

    you don't have a textfield name myQuestion when that code executes.