I'm a school teacher and I've made a video player which displays guitar video lessons for my pupils. It's made with the Flash video component for flv, AS2 and XML and the videos are published on a Flash media server (streaming server).
I first published the videos on my pupils' web site using html pages + the video component and it's working well.
Then I tried to make a flash video player, but it's not working as expected, and I can't find out why :
- only the first video of the video lists is played and if I try playing another, it freezes the animation.
- if I change which video is played first (if I change the code so that it plays the second or the third video first in a list, for instance), it will play the video. So I believe both the XML files and the video files are ok.
- I checked the data in the combo and saw it's ok too.
- The menus are displaying correctly.
In fact, everything is ok, until I cilck on the listbox to read another video.
So, in the end, I don't know what's wrong... Can someone help me ?
You can see the video player here :
http://guitare.bellepierre.info/flash/
(please note that the videos are not professional videos, it's just for my pupils to work at home).
I publish all the code below. Can someone tell me what is wrong with the listbox's code ?
There's a listener for the listbox and the listener is calling a function to play the video and this is what is not working. If I replace the videoPlay function with something like :
videoPlayer.play(file_url)
it won't work...
If I do the same elsewhere, it works. So I wonder if there is a problem of scope...
But in the videoPlay function, part of the code is executed :
function playVideo(){
videoPlayer.play(videoList_lst.getItemAt(n).data); => this one is not working when I click on the list box (but it does work in other functions). Why ?
videoList_lst.selectedIndex=n;
titre_txt.text=videos[n].attributes.titre; => this one is working !
}
Thank you for your help !
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
/*videos_cb is the combobox which displays the video categories.
videoList_lst is the listbox which displays the list of all the videos.
videoPlayer is the video component's name.
titre_txt is a text box displaying the video's title.*/
stop();
var videos:Array
var categorie:String = "musiques.xml";
videos_cb.selectedIndex=4;
var vList:XML = new XML();
vList.ignoreWhite = true;
var n:Number=0;
vList.load(categorie);
vList.onload = function(){
videos = this.firstChild.childNodes;
for(i=0;i<videos.length;i++){
videoList_lst.addItem(videos[i].attributes.desc,videos[i].attributes.chemin,videos[i].attributes.titre);
}
playVideo();
}
function playVideo(){
videoPlayer.play(videoList_lst.getItemAt(n).data);
videoList_lst.selectedIndex=n;
titre_txt.text=videos[n].attributes.titre;
}
// COMBOBOX
var comboListnr:Object = new Object();
comboListnr.change = function() {
videoPlayer.stop();
categorie=videos_cb.value;
videoList_lst.removeAll();
vList.load(categorie);
}
videos_cb.addEventListener("change",comboListnr);
// LISTBOX
var listListnr:Object = new Object();
listListnr.change = function() {
videoPlayer.stop();
n=videoList_lst.selectedIndex;
playVideo();
}
videoList_lst.addEventListener("change",listListnr);
This post has been edited by SecondSight: 04 August 2008 - 01:51 AM

New Topic/Question
Reply



MultiQuote




|