//http://www.adobe.com/devnet/flash/articles/video_playlist_06.html //Step 1: Import the required classes package { import flash.display.MovieClip; import flash.net.URLLoader; import flash.net.URLRequest; import flash.events.Event; import fl.controls.listClasses.CellRenderer; import fl.controls.ScrollBarDirection; import flash.display.SimpleButton; import flash.events.MouseEvent; import flash.external.ExternalInterface; //added // import fl.display.InteractiveObject.SimpleButton; //Step 2: Create the main constructor public class VideoPlaylist extends MovieClip { private var xmlLoader:URLLoader; public function VideoPlaylist():void { // Load the playlist file, then initialize the media player. xmlLoader = new URLLoader(); xmlLoader.addEventListener(Event.COMPLETE, initMediaPlayer); xmlLoader.load(new URLRequest("studentplaylist.xml")); // Format the tileList, specify its cellRenderer class. tileList.setSize(235, 386); tileList.x = 492 tileList.y = 32 tileList.columnWidth = 225; tileList.rowHeight = 70; tileList.direction = ScrollBarDirection.VERTICAL; tileList.setStyle("cellRenderer", Thumb); } public function initMediaPlayer(event:Event):void { var myXML:XML = new XML(xmlLoader.data); var item:XML; for each(item in myXML.vid) { // populate playlist. // Get thumbnail value and assign to cellrenderer. var thumb:String; if(item.hasOwnProperty("@thumb")>0) thumb = item.@thumb; // Send data to tileList. tileList.addItem({label:item.attribute("desc").toXMLString(), data:item.attribute("src").toXMLString(), source:thumb});; } // Listen for item selection. tileList.addEventListener(Event.CHANGE, listListener); // Select the first video. tileList.selectedIndex = 0; // And automatically load it into myVid. myVid.source = tileList.selectedItem.data; // Pause video until selected or played. myVid.pause(); } // Detect when new video is selected, and play it function listListener(event:Event):void { myVid.play(event.target.selectedItem.data); } } } /* closeWindow_btn.onRelease = function(){ getURL ("javascript:window.close()"); }; */