If you are wanting to create a display bar for a game for a preloader, then this might help you out.
To explain a little better what is happening I have used long varialble names which probably wouldnt be used in a flash application.
Downloading and opening the source file will help you to understand what I am saying below.
[AS]
countTotal = 267;
countProgress = 125;
greenBarTotalLength = 200;
greenBar.bar._width = ((countProgress/countTotal)*greenBarTotalLength);
[/AS]
Using:
countTotal for the maximum mark, e.g. full health.
countProgress for the current mark e.g. current health.
greenBarTotalLength is the size of your display bar.
greenBar is the display bar, bar is the moving part of the bar.
This bar will work with any length, and with any countProgress.
Explanation
Taking the bar to be display a percentage, which if you have taken a test, is worked out as, your mark divided by the total marks multiplied by 100.
Then to work out the extra part to be added, we take the length of the bar, divided it by a hundred and then multiplied the first part by this.
But because multiplication and divition is commutative when done correctly we can remove the mutliply by 100 from the first part and replace it with the total length.
200 / 100 * 100 = 200
Hope this helps. If you havent understood what I have said then please post here and I, or some one else, will try and help you