Skip to main content
Inspiring
May 25, 2018
Answered

Dynamic Text in button states (HTML5 Canvas on PC)

  • May 25, 2018
  • 2 replies
  • 1261 views

Hey folk,

are there restrictions around Dynamic Text in button states in HTML5?

In a simple button I have Dynamic Text in the 'Up' state. I press F6 in the 'Over' state then change that same Dynamic Text font (plus sort out the 'Hit' area) but when I test this it doesnt change for the 'Over' state when previewed or when tested on our server. It stays the same style as the 'Up' state.

An example button would be Roboto Regular 24pt on some text in the 'Up' state and then Roboto Black 24pt for the same text (but new keyframe) in the 'Over' state. I have Dynamic Text selected for both and the typeface (family) is selected from the Web Fonts area drop down (with an 'F' beside them). The 'Over' state in preview does not show the Black style when hovered over in preview.

In the above example if I changed the 'Over' font colour then that colour change shows in preview but still the 'Over' state style stays as Regular.

I've reset preferences, plus tried on my home PC and work PC with no difference. Also tested on Chrome, Firefox and Microsoft Edge. Animate CC is most recent version.

Maybe I've missed something really simple or it is just the way it is?

The explanation is a bit long winded but hope it gives a clear picture.

It's not the end of the world but thought I'd like to know for future.

Cheers

Greg

This topic has been closed for replies.
Correct answer JoãoCésar17023019

Oh sorry.

I misunderstood.

It's far from the ideal solution, but what you can do is to put the text in the over state inside of a Movie Clip.

Apparently, CreateJS don't set text fields the way we expect in frames other than the first.

I kinda tried to explain my point here:

Dynamic text update problem

I hope it helps.

Regards,

JC

2 replies

kglad
Community Expert
Community Expert
May 25, 2018

use static text in a button.

if you need dynamic text, use a movieclip button.

GoryGregAuthor
Inspiring
May 25, 2018

Ah right cheers. I was wondering if that is the only solution.

I'm trying to squeeze the file size down as much as possible (I've become obsessed with file size, performance and the users experience) where I can and hence using Dynamic Text for multiple buttons helps that- even if small file size saving.

JoãoCésar17023019
Community Expert
Community Expert
May 25, 2018

Hi.

Draw a rectangle in the hit frame to be used as the hit area.

Because if you put only the text, it will be very hard to detect the mouse hovering over.

GoryGregAuthor
Inspiring
May 25, 2018

Hi and thanks for that but I do that anyway. I should have added that to original text (I'd waffled on long enough ha ha). But that is not the problem.

Cheers

Greg

JoãoCésar17023019
Community Expert
JoãoCésar17023019Community ExpertCorrect answer
Community Expert
May 25, 2018

Oh sorry.

I misunderstood.

It's far from the ideal solution, but what you can do is to put the text in the over state inside of a Movie Clip.

Apparently, CreateJS don't set text fields the way we expect in frames other than the first.

I kinda tried to explain my point here:

Dynamic text update problem

I hope it helps.

Regards,

JC