using the code below, i'm trying to add scripted cue points so i can add stuff in at certain times. I have no cuepoints on my flv. I cannot find any documentation that i can understand as i'm a as3 newbie.
my poor attempt is using the NetStatusEvent.NET_STATUS event.
How do i do this using a dynamically added Video, it seems it is easier is i use a component, as these methods are documented!!!
PHP Code:var vid:Video = new Video(300, 250);
addChildAt(vid, 0);
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
vid.attachNetStream(ns);
var listener:Object = new Object();
listener.onMetaData = function(evt:Object):void {};
ns.client = listener;
/*ns.addEventListener(NetStatusEvent.NET_STATUS, statusHandler);
function statusHandler(evt:NetStatusEvent):void
{
trace( ns.time);
if(ns.time>0.5){
trace("0.5");
}
if(ns.time>3){
trace("3");
}
if(ns.time>5){
trace("5");
}
}
*/
ns.addEventListener(NetStatusEvent.NET_STATUS,netStatusStop);
function netStatusStop(evt:NetStatusEvent):void {
if (evt.info.code == "NetStream.Play.Stop") {
trace("end");
//goto beginning and play
//ns.seek(0);
//goto end and stop
ns.close();
}
}
ns.addEventListener(NetStatusEvent.NET_STATUS,netStatusStart);
function netStatusStart(evt:NetStatusEvent):void {
if (evt.info.code == "NetStream.Play.Start") {
//to pause and load first image
ns.seek(0.1);
ns.pause();
}
}
ns.play("test30.flv");


Reply With Quote