
Untitled
By: a guest on
May 18th, 2012 | syntax:
None | size: 0.90 KB | hits: 17 | expires: Never
var duration;
//Instantiate Video Object
var video:Video = new Video(591,290);
video.x = 0
video.y = 0
//Instantiate NectConnection
var nc:NetConnection = new NetConnection();
nc.connect(null);
//Instantiate Net Stream and link it to Net Connection
var ns:NetStream = new NetStream(nc);
// Prepare meta Object to receive extra information about NetStream
var meta:Object = new Object();
meta.onMetaData = function(meta:Object){
trace(meta.duration);
duration = meta.duration;
}
// Connect Meta to ns
ns.client = meta;
// Start playing the video through Net Stream
ns.play('chicago.flv');
// Plug Net Stream into video Object
video.attachNetStream(ns);
// Put video object on the stage
stage.addChild(video);
stage.addEventListener(Event.ENTER_FRAME, function(ev:Event){
progressBar.bar.scaleX = ns.time/duration;
trace(ns.time/duration);
});