MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 652

Actionscript language reference
Table of Contents

Advertisement

Description
Read-only property; the number of seconds assigned to the buffer by
NetStream.setBufferTime()
the number of seconds currently in the buffer, use
Example
The following example dynamically creates a text field that displays information about the
number of seconds that are currently in the buffer. The text field also displays the buffer length
that the video is set to, and percentage of buffer that is filled.
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("video1.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+"\t"+"Time:
"+my_ns.bufferTime+"\t"+"Buffer:"+bufferPct+"%";
output_str += "</textformat>";
buffer_txt.htmlText = output_str;
}
See also
NetStream.time
NetStream.bytesLoaded
Availability
Flash Player 7.
Usage
my_ns.bytesLoaded:Number
Description
Read-only property; the number of bytes of data that have been loaded into the player. You can
use this method in conjunction with
to being full—for example, to display feedback to a user who is waiting for data to be loaded into
the buffer.
652
Chapter 7: ActionScript for Flash
. The default value is .1(one-tenth of a second). To determine
NetStream.bufferLength
NetStream.bytesTotal
.
to estimate how close the buffer is

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flex

Table of Contents