# Media bar movement = total frames

**URL:** <https://forum.kirupa.com/t/media-bar-movement-total-frames/196217>\
**Category:** Uncategorized\
**Created:** [August 6, 2006, 11:23pm UTC](https://forum.kirupa.com/t/media-bar-movement-total-frames/196217 "2006-08-06T23:23:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hausnfranz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/hausnfranz/32/2427_2.png) [@Hausnfranz](https://forum.kirupa.com/u/Hausnfranz)\
**Post date:** [August 6, 2006, 11:23pm UTC](https://forum.kirupa.com/t/media-bar-movement-total-frames/196217/1 "2006-08-06T23:23:43Z")

</div>

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?

```auto

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;
		};
	}
};

```
