Hi Guys,
Please excuse me if this has already been mentioned (although I’ve strugged to find anything to help me out).
Here’s the scenario:
I have a .flv file which I am progressively downloading into a .swf file. The .swf file contains a control bar skin with the play, seek, volume features. All three elements (.flv, .swf and control bar) were generated from Flash 8.
I want to create a preloader so that when the buffer has reached 5 seconds, the video will start playing, and will continue from there on, regardless of the buffer state. It is only whilst the video is loading for 5 seconds worth of content to be in the buffer, that a preloader graphic should be displayed. After that, the video will play as normal.
I’ve obtained this code from the Adobe website:
this.createTextField(“buffer_txt”, this.getNextHighestDepth(), 10, 10, 300, 22);
buffer_txt.html = true;
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
stream_ns.setBufferTime(3);
my_video.attachVideo(stream_ns);
stream_ns.play(“videoDemo.flv”);
var buffer_interval:Number = setInterval(checkBufferTime, 100, stream_ns);
function checkBufferTime(my_ns:NetStream):Void {
var bufferPct:Number = Math.min(Math.round(my_ns.bufferLength/my_ns.bufferTime*100), 100);
var output_str:String = “<textformat tabStops=’[100,200]’>”;
output_str += "Length: “+my_ns.bufferLength+” "+“Time: “+my_ns.bufferTime+” “+“Buffer:”+bufferPct+”%”;
output_str += “</textformat>”;
buffer_txt.htmlText = output_str;
}
This particular code displays the buffer status all the way through the video in text form.
I know this may sound stupid, but if I have a visual called load.swf, and merely want to display that while the buffer is loading, then remove it completely, how is is called into the actionscript? Looking at the code above, I don’t think the checkBufferTime function is actually needed in this case.
Any help would REALLY be appreciated. Please be kind, I haven’t touched Actionscript for around 8 years, so am completely lost.