03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Example<br />

The following example dynamically creates a text field that displays information about the<br />

number of seconds that are currently in the buffer. The text field also displays the buffer<br />

length that the video is set to, <strong>and</strong> percentage of buffer that is filled.<br />

this.createTextField("buffer_txt", this.getNextHighestDepth(), 10, 10, 300,<br />

22);<br />

buffer_txt.html = true;<br />

var connection_nc:NetConnection = new NetConnection();<br />

connection_nc.connect(null);<br />

var stream_ns:NetStream = new NetStream(connection_nc);<br />

stream_ns.setBufferTime(3);<br />

my_video.attachVideo(stream_ns);<br />

stream_ns.play("video1.flv");<br />

var buffer_interval:Number = setInterval(checkBufferTime, 100, stream_ns);<br />

function checkBufferTime(my_ns:NetStream):Void {<br />

var bufferPct:Number = Math.min(Math.round(my_ns.bufferLength/<br />

my_ns.bufferTime*100), 100);<br />

var output_str:String = "";<br />

output_str += "Length: "+my_ns.bufferLength+"\t"+"Time:<br />

"+my_ns.bufferTime+"\t"+"Buffer:"+bufferPct+"%";<br />

output_str += "";<br />

buffer_txt.htmlText = output_str;<br />

}<br />

bufferTime (NetStream.bufferTime property)<br />

public bufferTime : Number [read-only]<br />

The number of seconds assigned to the buffer by NetStream.setBufferTime(). The default<br />

value is .1(one-tenth of a second). To determine the number of seconds currently in the<br />

buffer, use NetStream.bufferLength.<br />

Availability<br />

ActionScript 1.0; Flash Player 7<br />

NOTE: This property is also supported in Flash Player 6 when used with Flash Media<br />

Server. For more information, see the Flash Media Server documentation.<br />

Example<br />

The following example dynamically creates a text field that displays information about the<br />

number of seconds that are currently in the buffer. The text field also displays the buffer<br />

length that the video is set to, <strong>and</strong> percentage of buffer that is filled.<br />

NetStream 499

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!