Changing Text Captions by Code

Hi Friends, I woud like to know if it is possibe to change the text in a “Text Caption” by code? Or making it dynamic? If so is there any youtube tutorial for that?

Thanks!

Hi Deni,

ActivePresenter allows you to add animations for text without requiring any code, please refer to this tutorial for more information:

Video tutorials are also included in this.

1 Like

Thank you hang, but what I am planning to do is this:

When I press the button, some specific Text Caption changes their text.

Here is my sample project.
changing text captions.approj (284 KB)

I tried to write some JavaScript on it, but it didn’t work. Should I use the text entry object instead? What could possibly be the problem?

Thanks

Deni

You can use the text("new text") method as below to change text:

prez.object("Text Caption_3").text("newText");

Or, use the html("newText") as mentioned in the Manual (page 328) like this:

prez.object("Text Caption_3").html("newText");

Regards,
Hang

1 Like

Thanks Hang, I’ll test it and feedback here later. Thank you!

Yes, It did work greatly!
Thanks for your great support. One of the reasons I use your software as reference is the great customer serrvice you bring us. I should confess that I started studying some coding because of your software and the many possibilities I can use it. Thank you, again.

1 Like

Thank you. I really appreciate you taking time to express that.
Hopefully you have a nice experience while using our ActivePresenter.

1 Like

Hey Hang, one more question in the same issue. I tried the code you sent me before, it work good. But when I tried to manipulate the color of the text it didn’t work. I’m am trying to use it this way:
prez.object(“Text Caption_3”).html.style.font(“white”);

Can you please tell me what is the problem here?

You can use the html method, where the text is formatted according to HTML in this case.

prez.object("Text Caption_3").html('<div style="color:white;">Text here</div>');

Additionally, I think that using Object States is another simpler approach to accomplish this.
Please refer to this tutorial for more information:

Regards,

1 Like

Thank you,
it did work!

1 Like