[AS3] Controlling web video problem
I have a Flash website with a video page which uses the Flash FLV Video Component to play videos. I am trying to get the action script right to make the FLV Video Component play from a list of videos and I keep getting very strange compiler errors when I test my movie. The Compiler errors are:
MediaVideoMC, Layer 'Actions', Frame 1, Line 19
1084: Syntax error: expecting rightparen before colon.
MediaVideoMC, Layer 'Actions', Frame 1, Line 19
1078: Label must be a simple identifier.
MediaVideoMC, Layer 'Actions', Frame 1, Line 23
1084: Syntax error: expecting colon before assign.
Here is the action script I am using copied directly from the Adobe website with the identifier changed:
import fl.video.*;
import flash.events.Event;
import flash.net.*;
// Set Variables
var flvControl:FLVPlayback = VideoContainer;
var flvIndex:Number = 0;
var loopAtEnd:Boolean = true;
// Load XML file...
var xmlList:XML;
var xmlPath:String = "videos.xml";
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest(xmlPath));
// Receive the XML and load the first video function
// LINE 19--> xmlLoadedHandler(event:Event):void
{
// Save XML
xmlList = new XML(xmlLoader.data);
// Set video (Start)
flvControl.source = xmlList.video[0]};
}
xmlLoader.addEventListener(Event.COMPLETE, xmlLoadedHandler);
// Handle the video completion (load the next video)
function completeHandler(event:VideoEvent):void
{
// Get next item in list
flvIndex++;
// Validate index
if( flvIndex == xmlList.video.length () ){
if( loopAtEnd ){
flvIndex = 0;
}else{
return;
}
}
// Load the next video
flvControl.source = xmlList[flvIndex];
}
flvControl.addEventListener(VideoEvent.COMPLETE, completeHandler);
// Set the default video (Start)
flvControl.source = videoList[0];
I have been working on trying to fix this for days with no luck...Anyone who can help would be much appreciated...
Thank you!
|