# Progress Bar for a Movie

**URL:** <https://forum.kirupa.com/t/progress-bar-for-a-movie/12484>\
**Category:** flash\
**Created:** [January 31, 2003, 8:14pm UTC](https://forum.kirupa.com/t/progress-bar-for-a-movie/12484 "2003-01-31T20:14:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![asianmoths](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@asianmoths](https://forum.kirupa.com/u/asianmoths)\
**Post date:** [January 31, 2003, 8:14pm UTC](https://forum.kirupa.com/t/progress-bar-for-a-movie/12484/1 "2003-01-31T20:14:51Z")

</div>

I want to have a bar display the progress of a movie while it plays, like on Quicktime, Windows Media, etc.

I tried to use a preloader as a template while substituting frames for bytes, but I am having no luck. I used the following code on an instance of a symbol that appears throughout the movie, but that might not be the right method anyway:

onClipEvent (enterFrame) {  
lframe = \_root.\_currentframe;  
tframe = \_root.\_totalframes;  
percentFrame = Math.floor ((1frame/tframe)\*100));  
}  
onClipEvent (enterFrame) {  
bar.progress.\_xscale = percentProgress;

“bar” is the instance name of a box on the main timeline, and “progress” is the instance name of a line inside of the symbol “bar” that I am hoping to have expand while the movie plays. I attached the .fla to make it easier…

Thanks, in advance, for the help,

Asianmoths

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 31, 2003, 8:59pm UTC](https://forum.kirupa.com/t/progress-bar-for-a-movie/12484/2 "2003-01-31T20:59:18Z")

</div>

Hi asianmoths,

Have you seen this before. It is a pre-made movie controller that comes with Flash MX. It will work with imported videos or main timeline animation.

[http://www.macromedia.com/desdev/tip/019.html](http://www.macromedia.com/desdev/tip/019.html)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 31, 2003, 9:08pm UTC](https://forum.kirupa.com/t/progress-bar-for-a-movie/12484/3 "2003-01-31T21:08:38Z")

</div>

That is EXACTLY what I needed. Thanks, and thanks for the quick turnaround.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 31, 2003, 9:17pm UTC](https://forum.kirupa.com/t/progress-bar-for-a-movie/12484/4 "2003-01-31T21:17:08Z")

</div>

let’s fix your script :beam:

first … you don’t need to use the same handler twice:

```auto
**onClipEvent (enterFrame) {**
	lframe = _root._currentframe
	tframe = _root._totalframes
	percentFrame = Math.floor ((1frame/tframe)*100))
}
**onClipEvent (enterFrame) {**
	bar.progress._xscale = percentProgress
}

```

so you could just use:

```auto
onClipEvent (enterFrame) {
	lframe = _root._currentframe
	tframe = _root._totalframes
	percentFrame = Math.floor ((1frame/tframe)*100))
	bar.progress._xscale = percentProgress
}

```

now … your script is a mess !!

you’re targetting wrong  
it should be **\_root.bar.progress**  
but the script is in the movie clip progress so you can use **this** instead

another mistake …

```auto
onClipEvent (enterFrame) {
	[color=red]lframe[/color] = _root._currentframe
	tframe = _root._totalframes
	percentFrame = Math.floor (([color=red]1frame[/color]/tframe)*100))
	bar.progress._xscale = percentProgress
}

```

and another one !!

```auto
onClipEvent (enterFrame) {
	lframe = _root._currentframe
	tframe = _root._totalframes
	[color=red]percentFrame[/color] = Math.floor ((1frame/tframe)*100))
	bar.progress._xscale = [color=red]percentProgress[/color]
}

```

your script should be:

```auto
onClipEvent (enterFrame) {
	lframe = _root._currentframe;
	tframe = _root._totalframes;
	percentFrame = ((lframe/tframe)*100)
	this._xscale = percentFrame
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 31, 2003, 9:19pm UTC](https://forum.kirupa.com/t/progress-bar-for-a-movie/12484/5 "2003-01-31T21:19:35Z")

</div>

Here is another video controller that looks identical to the QT controller. Read through documentation on how to use.

[http://www.flashcomponents.net/component.cfm?nav=2&id=71](http://www.flashcomponents.net/component.cfm?nav=2&id=71)
