# Dynamic Text Within a MovieClip

**URL:** <https://forum.kirupa.com/t/dynamic-text-within-a-movieclip/315325>\
**Category:** flash\
**Created:** [October 22, 2010, 11:16pm UTC](https://forum.kirupa.com/t/dynamic-text-within-a-movieclip/315325 "2010-10-22T23:16:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Weena](https://avatars.discourse-cdn.com/v4/letter/w/51bf81/32.png) [@Weena](https://forum.kirupa.com/u/Weena)\
**Post date:** [October 22, 2010, 11:16pm UTC](https://forum.kirupa.com/t/dynamic-text-within-a-movieclip/315325/1 "2010-10-22T23:16:42Z")

</div>

Hi there. I’m a newbie AS3 coder and I’ve encountered quite an annoying problem, so I figured I’d come to the pros. 😃 I’m learning to code in the form of a game, so yeah.

What my current situation is is the following: I have the character’s health bar in a movie clip within a button, which is kind of the character stats module. For the health bar, I have some dynamic text which I’d like to display the number of health points the char has. However, the variable for the hp is located on a scripts layer on the stage, and I can’t figure out how to, using the script on the stage, to edit the dynamic text within the movieclip within the button.

Basically, here’s how it is. I have a button called _charStatsModule_. Within it is a movie clip called _charHealthBarMC_. Inside that, I have some dynamic text called _charHealthText_. In the scripts layer on the stage in which the button is located, I’ve set a variable called _charHealth_.

Anyway, what I’d like to know is, from the scripts layer on the stage, how would I be able to set _charHealthtext_ to display _charHealth_? I’ve got a feeling it may have something to do with _root_, but I’m not sure.

Thanks in advance!
