View comments | RSS feed

NetStream.time

Availability

Flash Player 7.

Note: This property is also supported in Flash Player 6 when used with Flash Communication Server. For more information, see the Flash Communication Server documentation.

Usage

my_ns.time:Number

Description

Read-only property; the position of the playhead, in seconds.

Example

The following example displays the current position of the playhead in a dynamically created text field called time_txt. Select New Video from the Library options menu to create a video object instance, and give it an instance name my_video. Add the following ActionScript to your FLA or AS file:

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("video1.flv");
//
stream_ns.onStatus = function(infoObject:Object) {
   statusCode_txt.text = infoObject.code;
};

this.createTextField("time_txt", this.getNextHighestDepth(), 10, 10, 100, 22);
time_txt.text = "LOADING";

var time_interval:Number = setInterval(checkTime, 500, stream_ns);
function checkTime(my_ns:NetStream) {
   var ns_seconds:Number = my_ns.time;
   var minutes:Number = Math.floor(ns_seconds/60);
   var seconds = Math.floor(ns_seconds%60);
   if (seconds<10) {
      seconds = "0"+seconds;
   }
   time_txt.text = minutes+":"+seconds;
}

See also

NetStream.bufferLength, NetStream.bytesLoaded

Comments


recoveredfromflashMX2004 said on Aug 4, 2004 at 3:45 PM :
rraga said on Mar 29, 2004 at 12:07 PM :

Wouldn't it make sense if LiveDocs are going to suggest that you use other documentation, that it provides the link?


MM tech writer said on Apr 1, 2004 at 12:44 PM :

The Flash Comm docs are installed on your hard drive when you install Flash Comm. For example, my Flash Comm docs are located here:

file:///C:/Program%20Files/Macromedia/Flash%20Communication%20Server%20MX/flashcom_help/html/default.htm


axcfalr';ql said on Jun 24, 2004 at 8:52 AM :

Livedocs to host Flash Comm docs? Could the Flash Comm docs also be added to the Livedocs collections?
colourbleu said on Sep 15, 2004 at 12:27 AM :
looks to me if this code is not necessary

stream_ns.onStatus = function(infoObject:Object) {
statusCode_txt.text = infoObject.code;

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001601.html