MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference page 984

Actionscript 2.0 language reference
Table of Contents

Advertisement

Example
The following example displays the current position of the playhead in a dynamically created
text field called
time_txt
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;
}
If your SWF file includes a version 2 component, use the version 2 components
DepthManager class instead of the
used in this example.
See also
bufferLength (NetStream.bufferLength property)
(NetStream.bytesLoaded property)
984
ActionScript classes
. Select New Video from the Library options menu to create a video
my_video
MovieClip.getNextHighestDepth()
. Create a new video object called
method, which is
,
bytesLoaded

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

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

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF