# Flv

**URL:** <https://forum.kirupa.com/t/flv/221531>\
**Category:** Uncategorized\
**Created:** [April 4, 2007, 10:45pm UTC](https://forum.kirupa.com/t/flv/221531 "2007-04-04T22:45:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![steresa](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@steresa](https://forum.kirupa.com/u/steresa)\
**Post date:** [April 4, 2007, 10:45pm UTC](https://forum.kirupa.com/t/flv/221531/1 "2007-04-04T22:45:54Z")

</div>

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](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);  
}  
}
