var netConn:NetConnection= new NetConnection();
netConn.connect(null);
var netStream:NetStream = new NetStream(netConn);
maVideo.attachVideo(netStream);
netStream.setBufferTime(3);
netStream.play("http://www.quart-avant-poing.com/video/martin_b_b_unc_x264.avi.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(0xFFFFFF);
moveTo(57,725);
lineTo(1223, 725);
lineTo(1223, 740);
lineTo(0, 740);
lineTo(0, 725);
endFill();
_xscale = 0;
_x = 57;
}
progressBar_mc.createEmptyMovieClip("stroke_mc", progressBar_mc.getNextHighestDepth());
progressBar_mc.createEmptyMovieClip("stroke_mc2", progressBar_mc.getNextHighestDepth());
with (progressBar_mc.stroke_mc) {
lineStyle(0, 0xFFFFFF);
moveTo(57, 725);
lineTo(57, 740);
lineTo(57, 725);
}
with (progressBar_mc.stroke_mc2) {
lineStyle(0, 0xFFFFFF);
moveTo(1280, 725);
lineTo(1280, 725);
lineTo(1280, 740);
}
var loaded_interval:Number = setInterval(checkBytesLoaded, 500, netStream);
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);
}
}
btn_l.onRelease = function() {
netStream.pause();
};
btn_a.onRelease = function()
{
netStream.play("" );
gotoAndStop(1);
};
|