Advertisement
Advertisement
| 07.09.2008 at 11:15AM PDT, ID: 23551238 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: |
var video:Video = new Video(1280,720);
addChild(video);
var xml:XML;
var whoIs:Number = 0;
var firstTime:Boolean = true;
var curVideo:String;
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);
function onStatusEvent(stat:Object):void
{
switch(stat.info.code){
case "NetStream.Play.Stop" :
if (whoIs<xml.video.length()-1){
whoIs++
}else{
ns.close()
gotoAndPlay(2);
}
curVideo = xml.video.attribute("vName")[whoIs];
ns.play("http://www.site.com/videos/"+curVideo);
}
}
var meta:Object = new Object();
meta.onMetaData = function(meta:Object)
{
trace(meta.duration);
}
ns.client = meta;
video.attachNetStream(ns);
/* XML Loading Code and Intial Display of Rates and header */
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);
function onLoaded(e:Event):void
{
xml = new XML(e.target.data);
curVideo = xml.video.attribute("vName")[whoIs];
ns.play("http://www.site.com/videos/"+curVideo);
}
loader.load(new URLRequest("http://www.site.com/xml.asp?zid=3"));
stop();
|