Heres the code that I’m using
var videoURL:URLRequest = new URLRequest("");
var connection:NetConnection;
var stream:NetStream;
function sec(e:IOErrorEvent){
trace(e);
}
var videoX:int = 0;
var videoY:int = 0;
var request:URLRequest = new URLRequest("main.xml");
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, done);
var xml:XML = new XML();
loader.load(request);
var duration:Number =0;
var streamArray:Array = [];
var video:Video = new Video(150, 200);
function done(e:Event){
xml = new XML(loader.data);
for(var i:int = 0; i< xml.video.length(); i++){
videoURL = new URLRequest(xml.video*.@url.toString());
videoX = xml.video*.@x;
videoY = xml.video*.@y;
connection = new NetConnection();
connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
connection.addEventListener(AsyncErrorEvent.ASYNC_ERROR, async);
connection.addEventListener(IOErrorEvent.IO_ERROR, sec);
video= new Video(150, 200);
connection.connect(null);
}
addEventListener(Event.ENTER_FRAME, loop);
}
var netClient:Object = new Object();
netClient.onCuePoint = onCuePoint;
netClient.onMetaData = onMetaData;
function loop(e:Event){
for(var k:int = 0; k < xml.video.length(); k++){
if(streamArray[k].time >= duration){
streamArray[k].seek(10);
}
}
}
function onCuePoint(info:Object):void
{
trace("cuePoint: time=" + info.time + " name=" + info.name + " type=" + info.type);
}
function onMetaData(info:Object):void
{ duration = (info.duration - 3);
trace("metadata: duration=" + info.duration + " width=" + info.width + " height=" + info.height + " framerate=" + info.framerate);
}
function async(event:AsyncErrorEvent){
trace ("there was an AsyncErrorEvent " +event);
}
function netStatusHandler(event:NetStatusEvent):void {
switch (event.info.code) {
case "NetConnection.Connect.Success":
connectStream();
break;
case "NetStream.Play.StreamNotFound":
trace("Stream not found: " + videoURL);
break;
}
}
function securityErrorHandler(event:SecurityErrorEvent):void {
trace("securityErrorHandler: " + event);
}
function connectStream():void {
stream = new NetStream(connection);
streamArray.push(stream);
stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
stream.client = netClient;
video.attachNetStream(stream);
video.x = videoX;
video.y = videoY;
stream.play(videoURL.url);
addChild(video);
}
Just to reiterate, the file works fine when I test it in Flash and as a projector. The video doesn’t load when I download the files from my server. I have checked to ensure that all the file paths are correct. Does anybody have any advice or suggestions? I appreciate any help that can be offered.