Hi,
I have a movie that loads flv videos from an xml file. They can take a while to load so need to add a loading bar. Not sure what I need to add to the following code so any help would be very much appreciated …
package {
import flash.display.MovieClip;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.MouseEvent;
import fl.controls.listClasses.CellRenderer;
import fl.controls.ScrollBarDirection;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
public class videos extends MovieClip {
private var xmlLoader:URLLoader;
public function videos():void {
// Load the playlist file, then initialize the media player.
xmlLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, initMediaPlayer);
xmlLoader.load(new URLRequest("http://staging.ph-creative.com/sites/hip/res/media/xml/playlist.xml"));
// Format the tileList, specify its cellRenderer class.
control.tileList.setSize(138, 108);
control.tileList.columnWidth = 46;
control.tileList.rowHeight = 54;
control.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.vid4) { // populate playlist.
// Get thumbnail value and assign to cellrenderer.
var thumb:String;
if(item.hasOwnProperty("@thumb")>0) thumb = item.@thumb;
// Send data to tileList.
control.tileList.addItem({label:item.attribute("desc").toXMLString(),
data:item.attribute("src").toXMLString(),
source:thumb});;
}
// Select the first video.
control.tileList.selectedIndex = 0;
// Listen for item selection.
control.tileList.addEventListener(Event.CHANGE, listListener);
// And automatically load it into myVid.
myVid.source = control.tileList.selectedItem.data;
}
// Detect when new video is selected, and play it
function listListener(event:Event):void {
myVid.play(event.target.selectedItem.data);
}
}
}