Hi guys
I have a working XML Video Playlist with a working video player, but i want to add the infomation from my .xml into a dynamic text field.
I have a movie clip called info_mc which has the dynamic text field in called infomation_txt, i want to place the XML infomation into the dynamic text field. and i want to place the date infomation into the date field called date_txt.
I have got the infomation for the first movie to be displayed, but when i click on another movie the infomation is staying the same. :oops:
How do i add the code so that it changes the infomation to the video currently playing ? what is the code i need to use?
XML CODE:
<?xml version="1.0" encoding="utf-8"?>
<videos>
<video url="GVideos/bfvietnam_pc32104_cut1OAPS.flv" desc="Battlefield Vietnam" date="27/1/07" info="AAAAAAAAAA" />
<video url="GVideos/cod2_ot_mul_092705OAPS.flv" desc="Call of Duty 2" date="28/1/07" info="BBBBBBBBBB" />
</videos>
FLASH CODE:
//Creating The Video Source To Run//
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(30);
ns.onStatus = function(info){
if(info.code == "NetStream.Buffer.Full"){
bufferclip._visible = false;
}
if(info.code == "NetStream.Buffer.Empty"){
bufferclip._visible = true;
}
if(info.code == "NetStream.Play.Stop"){
ns.seek(0);
}
}
theVideo.attachVideo(ns);
//Controls For Video Player//
rewind_btn.onRelease = function(){
ns.seek(0);
}
play_btn.onRelease = function(){
ns.pause();
}
//Video Progress Bar//
var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var duration:Number;
ns["onMetaData"] = function(obj) {
duration = obj.duration;
}
function videoStatus(){
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadbar._width = amountLoaded * 267.6;
loader.scrub._x = ns.time / duration * 267.6;
}
//The Scrubber - Moving Button To Move The Video Along Its Time Line//
var scrubInterval;
loader.scrub.onPress = function(){
clearInterval(videoInterval);
scrubInterval = setInterval(scrubit,10);
this.startDrag(false,0,this._y,257,this._y);
}
loader.scrub.onRelease = loader.scrub.onReleaseOutside = function(){
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus,100);
this.stopDrag();
}
function scrubit(){
ns.seek(Math.floor((loader.scrub._x/257)*duration));
}
//Right Click PopUp Menu On Video//
var theMenu:ContextMenu = new ContextMenu();
theMenu.hideBuiltInItems();
_root.menu = theMenu;
var i1:ContextMenuItem = new ContextMenuItem(".: Video Controls :.",trace);
theMenu.customItems[0]=i1;
var i2:ContextMenuItem = new ContextMenuItem("Play / Pause Video",pauseIt,true);
theMenu.customItems[1]=i2;
var i3:ContextMenuItem = new ContextMenuItem("Replay Video",repalyIt);
theMenu.customItems[2]=i3;
var i4:ContextMenuItem = new ContextMenuItem("Copyright 2006 The OAPS Clan",trace,true);
theMenu.customItems[3]=i4;
function pauseIt(){
ns.pause();
}
function repalyIt(){
ns.seek(0);
}
//Sound Interaction//
_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
vSound.attachAudio(ns) ;
var so:Sound = new Sound(vSound);
so.setVolume(100);
mute.onRollOver = function(){
if(so.getVolume() == 100){
this.gotoAndStop("onOver");
}
else {
this.gotoAndStop("muteOver")
}
}
mute.onRollOut = function(){
if(so.getVolume() == 100){
this.gotoAndStop("on");
}
else {
this.gotoAndStop("mute")
}
}
mute.onRelease = function(){
if(so.getVolume() == 100){
so.setVolume(0);
this.gotoAndStop("muteOver")
}
else {
so.setVolume(100);
this.gotoAndStop("onOver")
}
}
//Load XML Files Into List Component//
var vList:XML = new XML();
var inFO:Array = new Array;
var daTE:Array = new Array;
vList.ignoreWhite = true;
vList.onLoad = function(){
var videos:Array = this.firstChild.childNodes;
for(i=0;i<videos.length;i++){
videoList.addItem(videos*.attributes.desc,videos*.attributes.url);
inFO.push(videos*.attributes.info);
daTE.push(videos*.attributes.date);
}
ns.play(videoList.getItemAt(0).data);
videoList.selectedIndex = 0;
Info_mc.infomation_txt.text = inFO[0];
Info_mc.date_txt.text = daTE[0];
}
var vidList:Object = new Object;
vidList.change = function(){
ns.play(videoList.getItemAt(videoList.selectedIndex).data);
}
videoList.addEventListener("change",vidList);
vList.load("video.xml");
//Button To Scroll Video Infomation//
Info_mc.down_btn.onRelease = function(){
Info_mc.infomation_txt.scroll+=1
}
Info_mc.up_btn.onRelease = function(){
Info_mc.infomation_txt.scroll-=1
}
Basically im stuck with making the infomation change for each video, i gather that i have to do somthing when an item is selected from the video list component. But im not sure on how to do this?
Cheers
Dunkyb123