A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: XML video playlist

  1. #1
    Junior Member
    Join Date
    Feb 2005
    Posts
    27

    XML video playlist

    hey, i was following the video series with the xml playlist and i got stuck. my xml looks like

    <videos>
    <video url="www.something.com/t.flv" desc="the titles of video" about=" description of the video" />
    .....then repeated for all videos
    </videos>

    i have it on subydude.com/video working but with no description. i did however get it to show the description when you click on a title in the list component, but the video wont play. here is my code for the flash (part of it) hopefully someone can tell me what i em doing wrong. i no that the ns.play is trying to call the ".data" of the list component, so i took out the attributes.url to get my description to come up, but now i need another way for the ns.play to see the url to all my videos so i can have people click a titles - start the video - and get a description in a text box.

    var vlist:XML = new XML();
    vlist.ignoreWhite = true;
    vlist.load("videos.xml");

    vlist.onLoad = function() {
    var videos:Array = this.firstChild.childNodes;
    for(i=0;i<videos.length;i++) {
    videoList.addItem(videos[i].attributes.desc,videos[i].attributes.about);
    //videos[i].attributes.url,//
    }
    ns.play(videoList.getItemAt(0).data);
    videoList.selectedIndex = 0;
    textbox.text = (videoList.getItemAt(0).data);
    }

    var vidList:Object = new Object();
    vidList.change = function() {
    ns.play(videoList.getItemAt(videoList.selectedInde x).data);
    textbox.text = textbox.text = (videoList.getItemAt(videoList.selectedIndex).data );
    }
    videoList.addEventListener("change",vidList);

    videoList.setStyle("selectionColor",0xCCCCCC);
    videoList.setStyle("textSelectedColor",0x000000);
    videoList.setStyle("rollOverColor",0xCCCCCC);



    http://subydude.com/jared/video.html <---what i want (so close!!)
    http://subydude.com/video <----what it is now

  2. #2
    Junior Member
    Join Date
    Oct 2006
    Posts
    1
    I'm looking to do the same thing. Anyone have an answer for this? He seems to have gotten it to work on his site.

  3. #3
    Junior Member
    Join Date
    Feb 2005
    Posts
    27
    i got it to work but i dont have time right now to tell you the exact part that i changed but you can figure it out. here is the current script.

    Code:
    videoList_xml.onLoad = function(success:Boolean):Void{
    	if(success){
    		RootNode = this.firstChild;
    		videoArray = RootNode.childNodes;
    		populateList();
    		
    		}else{
    		trace("error loading xml file");
    		}
    }
    
    videoList_xml.load("videos.xml");
    
    
    function populateList():Void{
    	for(var i:Number=0; i<videoArray.length; i++){
    		videoList_cmp.addItem(videoArray[i].attributes.desc, videoArray[i].attributes.url);
    		videoList_cmp.selectedIndex = 0;
    		videoList_cmp.getItemAt(i).description = videoArray[i].attributes.about;
    		}
    		//play first movie automatically
    		//ns.play(videoList_cmp.getItemAt(0).data);
    		//textbox.text = videoList_cmp.getItemAt(0).description;
    }
    
    //create videoList listener
    
    var videoListener:Object = new Object();
    
    videoList_cmp.addEventListener("change", videoListener);
    
    videoListener.change = function():Void{
    	ns.play(videoList_cmp.getItemAt(videoList_cmp.selectedIndex).data);
    	textbox.text = videoList_cmp.getItemAt(videoList_cmp.selectedIndex).description;
    }
    
    videoList.setStyle("selectionColor",0xCCCCCC);
    videoList.setStyle("textSelectedColor",0x000000);
    videoList.setStyle("rollOverColor",0xCCCCCC);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center