Help with dynamic text field

Hello everyone. I’m having a bit of trouble creating some dynamic text elements for a game UI

As far as I understand, they take a variable as the value to show, which is presumably automatically updated whenever that variable changes.

I’m not quite sure how to set that though, or to have it appropriately scoped. How I’m wanting to structure things is:

  1. An instance of “interface” class is created onstage (extends movieclip). Interface contains two notable variables, currentHealth and maxHealth, which are public and remotely set by other classes.
  2. Within instance, I’ll add a child which is an instance of healthbar class (also movieclip)
  3. Inside healthbar is text, which I want to be dynamically set to read:

currentHealth/maxHealth

I’m not sure if it’s possible to do that in one dynamic text field. But if not, then I’d like to do it in three. currentHealth would be right aligned, the “/” in the middle would be static, and maxHealth would be left aligned.

Can someone provide a brief outline of how to do this ?