Media bar movement = total frames

Hi all,

I am almost done with a simple media bar that I created, however, I am having trouble syncing the end of the media bar movement with the end of the main movie.

The parent mc has 1861 frames.
The distance of x between start / finish of the media bar is 355.

So, if there are 1861 frames, the indicator needs to move 5.24… x every 1 frame.
1861/355 = 5.24…

The problem is that the indicator reaches the end more quick than the finale of the main movie. Is it the onEnterFrame that is the problem?


var dframe:Number = _parent._totalframes;
var dmedia:Number = 355;
var mball:Number = (dmedia/dframe);
var checkState:Boolean = false;
trace(mball)
mediabar.ball.onEnterFrame = function() {
	mediabar.ball._x += mball;
//	trace(_parent._totalframes);
};
mediabar.ball.onPress = function() {
	if (checkState == false) {
		checkState = true;
		_parent.stop();
		//movie is playing, so pause it on press
		delete mediabar.ball.onEnterFrame;
	} else if (checkState == true) {
		checkState = false;
		_parent.play();
		//movie is puased, so start it playing again.
		mediabar.ball.onEnterFrame = function() {
			mediabar.ball._x += mball;
		};
	}
};