Flv

I created a flv file with flash professional 8 and I tried to make a pre loader for the video. The video is located on the server and I am using progressive download. I found this actionscript for a loader but when I use it, the video begins to play while the loader is going. I also noticed that I get a strange echo from the audio of the video almost like the video is playing twice. [COLOR=“DarkRed”]I wan’t to create a pre loader that shows a progress bar and once it reaches 100 %, the video begins to play.[/COLOR][/COLOR] I made a simple loader for my website that does this but I am having trouble doing it for this flv file. Here is the actionscript that I used

var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
my_video.attachVideo(stream_ns);
stream_ns.play(“http://www.helpexamples.com/flash/video/typing_short.flv”);

this.createTextField(“loaded_txt”, this.getNextHighestDepth(), 10, 10, 160, 22);
this.createEmptyMovieClip(“progressBar_mc”, this.getNextHighestDepth());
progressBar_mc.createEmptyMovieClip(“bar_mc”, progressBar_mc.getNextHighestDepth());
with (progressBar_mc.bar_mc) {
beginFill(0xFF0000);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 10);
lineTo(0, 10);
lineTo(0, 0);
endFill();
_xscale = 0;
}
progressBar_mc.createEmptyMovieClip(“stroke_mc”, progressBar_mc.getNextHighestDepth());
with (progressBar_mc.stroke_mc) {
lineStyle(0, 0x000000);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 10);
lineTo(0, 10);
lineTo(0, 0);
}

var loaded_interval:Number = setInterval(checkBytesLoaded, 500, stream_ns);
function checkBytesLoaded(my_ns:NetStream) {
var pctLoaded:Number = Math.round(my_ns.bytesLoaded / my_ns.bytesTotal * 100);
loaded_txt.text = Math.round(my_ns.bytesLoaded / 1000) + " of " + Math.round(my_ns.bytesTotal / 1000) + " KB loaded (" + pctLoaded + “%)”;
progressBar_mc.bar_mc._xscale = pctLoaded;
if (pctLoaded>=100) {
clearInterval(loaded_interval);
}
}