Health bar (help)

Hello
I’m currently working on a game (MX), that requires a dynamic health bar.

For instance, a user can at any time change the health bars full/total health from 1 - infinity. However, it must also at the same time keep a constant height of 10px/width of 100 px. Here’s the problem… I tried various ways to accomplish, but all had their same faulty side. I tried a variable controlled bar, frame by frame, and no luck…

I know this effect is possible( A game seen by a site). However, I’m completely stumped. I’ve checked Kirupa forums “search option” for the words “health bar, bar, health, hp”

I’ve tried this which comes probably the closest to my goal, but still fails.

  1. A rectangle and the outline. The rectangle with a var “bar”, and outline + bar with var “line”
  2. I then added a total = current; total being the max hp attained and current as the current depreciable hp.
  3. total = 100;
  4. _root.line.bar._width = total;