Hello everyone,
I have a problem using the FLV Playback video component and using the list
component. What I am trying to do is create
a video playlist and simply load the videos as the user selects them from the
list.
Here is how I have my file set up:
1) There is a FLV Playback component on the stage.
2) There is a List component on the stage as well.
3) I am writing the code externally (creating a .as file).
4) I am loading the playlist via XML.
Now everything seems ok except that when publish the flash file and select a
movie from the playlist
I receive the following error:
1005: Invalid xml: URL: "videos/mazda6.flv" No root node found; if file is an
flv it must have .flv extension
Now I know for sure that all the videos are flv's and the XML file is formated
correctly so I have no idea why this is happening. I search the web and even
the macromedia (adobe) online docs and could not find a good answer.
Below is the XML file as well as the code (code is not cleaned up yet so do
not yell at me).
ACTIONSCRIPT FILE
// Import the FLV playBack class
import mx.video.FLVPlayback;
var videoPlayer:FLVPlayback;
// Import the built in flash Xpath API
import mx.xpath.XPathAPI;
// Basic variable name
var doc:XML;
function init() {
// Load the xml document
doc = new XML();
doc.ignoreWhite = true;
doc.onLoad = xmlLoaded;
doc.load("videoPlayList.xml");
}
init();
// Check to see if the XML Document has succesfully loaded (true or false)
function xmlLoaded(success:Boolean) {
if (success) {
var videoDesc = XPathAPI.selectNodeList(this.firstChild,
"/content/videoDesc/*");
var videoSrc = XPathAPI.selectNodeList(this.firstChild,
"/content/videoSource/*");
videoPlayer.playButton = vidPlay_btn;
videoPlayer.pauseButton = vidPause_btn;
videoPlayer.stopButton = vidStop_btn;
videoPlayer.volumeBar = vidVol_btn;
videoPlayer.muteButton = vidMute_btn;
videoPlayer.seekBar = vidSeek_btn;
videoPlayer.bufferingBar= vidBuff_btn;
for (var i=0; i < videoDesc.length; i++){
vDesc = videoDesc;
vSrc = videoSrc;
//vSrc = "videos/mazda6.flv";
videoList.addItem({label:vDesc,data:vSrc});
}
// create a listener that responds
// to changes in the listbox
var vidListener:Object = new Object();
vidListener.change = function() {
trace(videoList.getItemAt(videoList.selectedIndex).data);
// play the item selected in listbox
videoPlayer.play(videoList.getItemAt(videoList.selectedIndex).data);
};
// register the event listener to listbox
videoList.addEventListener("change", vidListener);
}
else {
trace("Error loading XML");
}
}
===================================================
XML FILE
<?xml version="1.0" encoding="utf-8"?>
<content>
<videoDesc>Cool fight shit</videoDesc>
<videoSource>videos/mazda6.flv</videoSource>
<videoDesc>Another fight shit</videoDesc>
<videoSource>videos/fight.flv</videoSource>
<videoDesc>some other video</videoDesc>
<videoSource>videos/test.flv</videoSource>
<videoDesc>another video - 1/21/07</videoDesc>
<videoSource>videos/test.flv</videoSource>
</content>
I really appreciate anyone's help.
Thank you.:confused;