Progress Bar for a Movie

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

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

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

let’s fix your script :beam:

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

**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:

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 …

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 !!

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:

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

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