PDA

View Full Version : Looping NetStream Video



jazzman121
June 8th, 2008, 05:35 PM
hi! im trying to loop a H.264 video that im loading up into my site.. in AS3 but i cant figure out how to loop it.. please help


var video:Video;
var connect_nc:NetConnection = new NetConnection();
connect_nc.connect(null);
var stream_ns:NetStream = new NetStream(connect_nc);
stream_ns.client = this;

function netStatusHandler(p_evt:NetStatusEvent):void
{
if(p_evt.info.code == "NetStream.Play.FileStructureInvalid")
{
trace("The Movie's file structure is invalid");
}
else if(p_evt.info.code == "NetStream.Play.NoSupportedTrackFound")
{
trace("The Movie doesn't contain any supported tracks");
}
}
stream_ns.addEventListener(NetStatusEvent.NET_STAT US, netStatusHandler);

video = new Video();
video.width = 1000;
video.height = 170;
video.x = -45;
video.y = 0;

addChild(video);
video.attachNetStream(stream_ns);
stream_ns.play("theMovie.mov");

dail
June 8th, 2008, 07:17 PM
you need to listen for the netstream.Play.stop info code, which indicates the end of a file, and then set your movies seek to 0.