CODE
var nc:NetConnection
var ns:NetStream
var streamLength:Number;
nc = new NetConnection();
nc.onStatus = function(info){
trace(info.code);
if(info.code.indexOf("Success") != -1) {
getStream();
}
}
function getStream(){
ns = new NetStream(nc);
ns.onMetaData = function(info){
streamLength = info.duration;
}
vid.attachVideo(ns);
ns.onStatus = function(info){
trace("ns status: " + info.code);
}
ns.setBufferTime(5);
//ns.play("BCLionsStreetParty2007v1");
ns.play("col");
startUpApp()
}
function startUpApp() {
_root.onEnterFrame = function(){
bufferLengthText.text = ns.bufferLength;
timeText.text = Math.round(ns.time * 100) / 100;
var total = Math.round((ns.time + ns.bufferLength) * 100) / 100;
var perc = Math.round((total / streamLength) * 10000 ) / 100;
var percWatched = Math.round((ns.time / streamLength) * 10000) / 100;
percentWatchedText.text = percWatched;
percentLoadedText.text = perc;
progressBar.scrubber._x = 320 * (percWatched / 100);
progressBar.bufferBar._width = 320 * (perc / 100);
}
}
progressBar.bufferBar._width = 0;
nc.connect("rmtp://205.234.239.103/fmsgurubuffertutorial/tutorial");
In implementing the following errors were made:
Line 15: Access of possibly undefined property onMetaData through a reference with static type flash.net:NetStream.
Line 18: Call to a possibly undefined method attachVideo through a reference with static type flash.media:Video.
Line 19: Attempted access of inaccessible property onStatus through a reference with static type flash.net:NetStream.
Line 22: Call to a possibly undefined method setBufferTime through a reference with static type flash.net:NetStream.
Line 29: Access of undefined property _root.
Line 31: Implicit coercion of a value of type Number to an unrelated type String.
Line 32: Implicit coercion of a value of type Number to an unrelated type String.
Line 6: Access of possibly undefined property onStatus through a reference with static type flash.net:NetConnection.
I could not identify the error!