FLV video progress bar


I’ve been stuck on this for ages now. I have a player that streams an .flv file but I need it to have a progress bar so people can see how much has loaded while its playing…

You can see the player here:http://www.mybadluck.com/video/video.html

The thin black line in the scrub bar is an MC called progressBar and has the following script:

[size=1][color=DarkOrange]*bLoad = this._parent._parent.videoDisplay.bytesLoaded;
bTotal = this._parent._parent.videoDisplay.bytesTotal;

if (bLoad < bTotal) {
progressBar._xscale = (bLoad/bTotal)*100;
} else {
progressBar._xscale = 100;
gotoAndStop (3);

*[size=2][color=Black]videoDisplay is a media component with an .flv.

Is it that this script cant grab the streaming info and make the progress bar work?

many thanks in advance…


I’ve created a flash file that you can plug any movie into. It has the progress bar setup so regardless of the movie size it will update at the rate of your fps. 12 fps is usually good but it could be anything.

Here’s some more insight on true streaming versus progressive streaming. The only way to avoid a progressive stream (where the file loads to your computer) is to use flash communications server. This is just like a windows media file. Without a streaming server you will get a progressive download (downloads and caches as it plays). This is not a limitation, but a choice. You face the same situation with RealVideo, Windows Media, etc… No streaming server, no true stream.

Flash 2004 Pro .fla File attached.




Thats great and works really well…however… the video player I have made uses the Media Component and has a scrub bar, play/pause buttons and a volume bar. As soon as I swap the media component for an embedded video that uses the [color=SandyBrown]my_Video.attachVideo(netStream);[color=Black] I lose all the functionality but gain a progress bar.

This is pretty weird… could you have a quick look?


If this works WITH the progress bar then I’ve got a pretty nifty standard video player I can make available as a source file…



That’s the catch with the embedded video component. You’ve got to create your own controllers. It’s a good trade though, it’s not to crazy difficult to do. I highly recommend taking a look at a complete project created by the macromedia guys. It has all the source files and video files to play around with. Here’s the link:


Glad to help,


have sorted it now

Check it out under ‘Motion’ at www.mybadluck.com

Thanks guys…


You’ve got me thinking now. I think my solution will work with these two modifications. Instead of loading the video into an embedded video component you use the media playback component. Then to load a movie into that dynamically you use the media.setMedia() – Then my loader bar code should work by testing the bytes loaded / total with the media.bytesLoaded and media.bytesTotal.


Okay you’ve modified it successfully it seems. How did you do it? Also how are you doing the volume slider? Cool work.


Yeah this is pretty groovy. All you need is this code in an actions frame.


//=============Loading Percent Bar Code=====================

listenerObject = new Object();
listenerObject.progress = function(eventObject){
   // insert your code here
	var vidBytesLoaded = videoDisplay.bytesLoaded;
	var vidBytesTotal = videoDisplay.bytesTotal;
	if (vidBytesLoaded <= vidBytesTotal) {
		var vidPercentLoaded = Math.floor((vidBytesLoaded/vidBytesTotal) * 100);
		percent.text= vidPercentLoaded + "% Loaded";
videoDisplay.addEventListener("progress", listenerObject)

Its pretty weird cause I tried the videoDisplay bytesloaded before and it didnt work - now it does…

MX2004 weirdness?

Anyway…happy now