here, you would need to make the bars instance name bar_mc, and make a text box for the score with an instance name of score_mc, this goes on main timeline
//declaring variables
var barspeed:Number = -5;//will be used to change the bars _xscale
var score:Number = 0;//the score
var barInterval:Number = setInterval(barGrow, 50);//this will call the barGrow function
//onLoad
bar_mc._xscale = 50; // starting the bar at half the size
// functions
function barGrow() {
if (bar_mc._xscale>=100 || bar_mc._xscale<= 0) { //if the bar reaches its width
barspeed*= -1 // then reverse the bar
}
bar_mc._xscale += barspeed;
}
// events
bar_mc.onRelease = function() {
clearInterval(barInterval); // stop the bar from moving
barspeed = 0; // stop the bar
score = bar_mc._xscale; // set the score
score_mc.text = score; // make the text box read out the score
}