Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Quick Question With Xml Video Playlist



my video playlist is working perfect.. just have one question... when a user clicks on a video from the playlist, it plays then repeats itself.. i'd like it to jump automatically to the next video in the playlist.... does anybody know what adjustments i would need to make in the code below to make this happen?

thanks in advance..
kind regards,
adam

:: Code Begins ::

var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);

theVideo.attachVideo(ns);

ns.setBufferTime(10);

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);

}
}

pauseButton.onRelease = function() {
ns.pause();
pauseButton._visible = false;
playButton._visible = true;
}

playButton._visible = false; {
}

playButton.onRelease = function() {
ns.pause();
pauseButton._visible = true;
playButton._visible = false;
}

rewindButton.onRelease = function() {
ns.seek(0);
}

this.createEmptyMovieClip("vFrame",this.getNextHig hestDepth());
vFrame.onEnterFrame = videoStatus;

var amountLoaded:Number;
var duration:Number;

ns["onMetaData"] = function(obj) {
duration = obj.duration;
}

function videoStatus() {
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
loader.loadbar._width = amountLoaded * 208.9;
loader.scrub._x = ns.time / duration * 208.9;
}

var scrubInterval;

loader.scrub.onPress = function() {
vFrame.onEnterFrame = scrubit;
this.startDrag(false,0,this._y,208,this._y);
}

loader.scrub.onRelease = loader.scrub.onReleaseOutside = function() {
vFrame.onEnterFrame = videoStatus;
this.stopDrag();
}

function scrubit() {
ns.seek(Math.floor((loader.scrub._x/208)*duration));
}

var theMenu:ContextMenu = new ContextMenu();
theMenu.hideBuiltInItems();
_root.menu = theMenu;

var item1:ContextMenuItem = new ContextMenuItem("::::: Video Controls :::::",trace);
theMenu.customItems[0] = item1;

var item2:ContextMenuItem = new ContextMenuItem("Play / Pause Video",pauseIt,true);
theMenu.customItems[1] = item2;

var item3:ContextMenuItem = new ContextMenuItem("Replay the Video",restartIt);
theMenu.customItems[2] = item3;

var item4:ContextMenuItem = new ContextMenuItem(" 2005 Lee Brimelow",trace,true);
theMenu.customItems[3] = item4;

function pauseIt() {
ns.pause();
}

function stopIt() {
ns.seek(0);
ns.pause();
}

function restartIt() {
ns.seek(0);
}

_root.createEmptyMovieClip("vSound",_root.getNextH ighestDepth());
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");
}
}

var vlist:XML = new XML();
vlist.ignoreWhite = true;

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.url);
}

ns.play(videoList.getItemAt(0).data);
videoList.selectedIndex = 0;
}

var vidList:Object = new Object();

vidList.change = function() {
ns.play(videoList.getItemAt(videoList.selectedInde x).data);
pauseButton._visible = true;
playButton._visible = false;
}

videoList.addEventListener("change",vidList);

vlist.load("calls.xml");

videoList.setStyle("selectionColor",0xCCCCCC);
videoList.setStyle("textSelectedColor",0x333333);
videoList.setStyle("rollOverColor",0x6AB2FF);
videoList.setStyle("color",0x333333);
videoList.setStyle("backgroundColor",0xFFFFFF);



FlashKit > Flash Help > Flash ActionScript
Posted on: 11-21-2008, 07:02 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

XML Video Playlist: Cannot Get 2nd Video To Play Upon Click
Hey guys. I did the video tutorials exactly as indicated on the site here but I cannot seem to get the second video to play once I click on that item in the video list. There are not action script errors. I have attached my action script and the .xml file. Any help would be greatly appreciated since I'm trying to meet a deadline. Thanks.

Here is my action script code:
Code:

var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(3);
ns.onStatus = function(info) {
   if (info.code == "NetStream.Buffer.Full") {
      bufferClip._visible = false;
   }
   if (info.code == "NetStream.Buffer.Empty") {
   }
   if (info.code == "NetStream.Play.Stop") {
      ns.seek(0);
   }
};
theVideo.attachVideo(ns);
rewindButton.onRelease = function() {
   ns.seek(0);
};
playButton.onRelease = function() {
   ns.pause();
};
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*137.5;
   loader.scrub._x = ns.time/duration*137.5;
}
var scrubInterval;
loader.scrub.onPress = function() {
   clearInterval(videoInterval);
   scrubInterval = setInterval(scrubit, 10);
   this.startDrag(false, -7, this._y, 128, this._y);
};
loader.scrub.onRelease = loader.scrub.onReleaseOutside=function () {
   clearInterval(scrubInterval);
   videoInterval = setInterval(videoStatus, 100);
   this.stopDrag();
};
function scrubit() {
   ns.seek(Math.floor((leader.scrub._x/128)*duration));
}
var theMenu:ContextMenu = new ContextMenu();
theMenu.hideBuiltInItems();
_root.menu = theMenu;
//new menu
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", replayIt);
theMenu.customItems[2] = i3;
var i4:ContextMenuItem = new ContextMenuItem("Copyright Brevard Public Schools", trace);
theMenu.customItems[3] = i4;
function pauseIt() {
   ns.pause();
}
function replayIt() {
   ns.seek(0);
}
_root.createEmptyMovieClip("vSound", _root.getNextHightstDepth());
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.onOut = 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");
   }
};
var vlist:XML = new XML();
vlist.ignoreWhite = true;
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.url);
   }
   ns.play(videoList.getItemAt(0).data);
   videoList.selectedIndex = 0;
};
var vidList:Object = new Object();
vidlist.change = function() {
   ns.play(videoList.getItemAt(videoList.selectedIndex).data);
};
videoList.addEventListener("change", vidList);
vlist.load("videos.xml");


here is my videos.xml file
Code:

<?xml version ="1.0" encoding="ISO-8859-1"?>
<videos>
<video url="vid1.flv" desc="Introduction" />
<video url="05intro.flv" desc="Interviews" />
<video url="vid1.flv" desc="Employee of the Year" />
<video url="vid1.flv" desc="Assistant Superintendent" />
</videos>[/code]

XML Video Playlist Tutorial (Video Not Showing)
hmmm, a little problem. I followed the tutorial, and when testing my movie I only get sound from the video but no picture. Playing the flv's on their own in my flv player work fine. Any Suggestions?

Code:

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);
   }
}

rewindButton.onRelease = function() {
   ns.seek(0);
}

playButton.onRelease = function() {
   ns.pause();
}

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 * 236;
   loader.scrub._x = ns.time / duration * 236;
}

var scrubInterval;

loader.scrub.onPress = function() {
   clearInterval(videoInterval);
   scrubInterval = setInterval(scrubit,10);
   this.startDrag(false,0,this._y,229,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/229)*duration));
}

function pauseIt() {
   ns.pause();
}

function replayIt() {
   ns.seek(0);
}

_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");
   }
}

var vList:XML = new XML();
vList.ignoreWhite = true;

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.url);
   }
   
   ns.play(videoList.getItemAt(0).data);
   videoList.selectedIndex = 0;
}

var vidList:Object = new Object();

vidList.change = function() {
   ns.play(videoList.getItemAt(videoList.selectedIndex).data);
}

videoList.addEventListener("change",vidList);

vList.load("video.xml");

Video Playlist - Next Video (FLV Files)
I am trying to create a simple playlist.

Once an external FLV file finishes playing, I would like to automatically load the next external FLV file. The only way I can do this currently is by placing Next and Prev buttons to make the user navigate from video to video, but this option is not automatic. Any ideas?

On a more complicated note... I am trying to create an XML driven Video Playlist. (For examples see AOL's top 11 http://music.aol.com/top11/ or MTV's Overdrive http://www.mtv.com/overdrive/).

Thanks!

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

XML Video Playlist Help
Hello everyone,

I having a little trouble trying to expand upon the XML video playlist created by Lisa Larson on the Flash Developer Center. You can see the tutorial I'm referring to here:
BTW, the sample link on the tutorial page appears to be broken, so I've posted a sample of the finished piece here.

Anyways, I'd like to add another dynamic element to this application... When a user clicks on an item in the list, I'd like a link/button (URL to be determined in the external XML file) to appear on the stage along with the selected video. I'd also love to be able to add a text description about the video file, but the link is priority numero uno.

I've attempted to decipher the actionscript from the tutorial several times, as well as slaving over several other similar tutorials, but I'm not having any luck... I'm hoping someone here might have tried something similar and had better results than myself. Any help is greatly appreciated!

BTW, here's the relevant AS:

Code:
//Function to handle what happens when an item in the list is selected
listListener.change = function( evtobj ) {
var nav = list.dataProvider[list.selectedIndex];
nc = new NetConnection(); //create a connection
nc.connect( null );//null connection for progressive download
ns = new NetStream(nc); //create a stream
video.attachVideo(ns); //pipe stream to this video object
// walk through the chosen item, build and play it
var reset = true;
for ( var i = 0; i < nav.childNodes.length; i++ ) {
var stream = nav.childNodes[i];
if ( stream.nodeName == "stream" ) {
// build path to flv, and play it
myStreamPath = nav.attributes.url + "/" + stream.attributes.name;
ns.setBufferTime(10);
ns.play( myStreamPath);
reset = false;
}
}
}

//Add an event listener on the list, when it triggers, run the listListener function to repopulate the list
list.addEventListener("change", listListener);


//Function that loads the XML file, parses it, and builds the list of available video clips
var xmllist = new XML(); //setup a variable to hold the XML
xmllist.ignoreWhite = true;
xmllist.load( "playlist-demo-1.xml" ); //load the XML file
//The following gets called when the XML has been loaded
xmllist.onLoad = function( status ) {
if ( !status )
trace( status );
var entries = this.childNodes[0];
var playlists = {};
var nav = [];
for ( var i = 0; i < entries.childNodes.length; i++ ) {
var entry = entries.childNodes[i];
if ( entry.nodeName == "listitem" )
//builds array of video clip names
playlists[entry.attributes.name] = entry;
else if ( entry.nodeName == "menu" ) {
//builds array of available videos
for ( var j = 0; j < entry.childNodes.length; j++ )
nav[j] = playlists[entry.childNodes[j].attributes.name];
} //end else if
} //end if

//sends the array of videos to the listbox UI
list.dataProvider = nav;
} //end xmllist.onload
Thanks again!
~Ryan

XML Video Playlist HELP
Hello

I followed Lee Brimelow's flv tutorial on creating an xml video playlist. I have 7 videos on the xml playlist that I would like the user to choose from, but when tested the only video that loads and regardless of what video that is chosen on the playlist, video 2 is the only video that plays. I am new to this style of actionscript (hence the tutorial) so if anyone could help me or point me in the right direction, that would be great.

Here is my actionscript: (All From Lee Brimelow's Tutorials (XML and Video Basics)


Code:
var vlist:XML = new XML();
vlist.ignoreWhite = true;

vlist.onLoad = function() {
var videos:Array = this.firstChild.childNodes;
for(i=0;i<videos.length;i++) {
videoList.addItem(videos[i].attributes.desc,videos[1].attributes.url);
}

ns.play(videoList.getItemAt(0).data);
videoList.selectedIndex = 0;
}

var vidList:Object = new Object();

vidList.change = function() {
ns.play(videoList.getItemAt(videoList.selectedInde x).data);
}

videoList.addEventListener("change",vidList);

vlist.load("videos.xml");
here is my XML:

Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<videos>
<video url="http://mydomain.com/flv/video_1.flv" desc="video_1" />
<video url="http://mydomain.com/flv/video_2.flv" desc="video_2" />
<video url="http://mydomain.com/flv/video_3.flv" desc="video_3" />
<video url="http://mydomain.com/flv/video_4.flv" desc="video_4" />
<video url="http://mydomain.com/flv/video_5.flv" desc="video_5" />
<video url="http://mydomain.com/flv/video_6.flv" desc="video_6" />
<video url="http://mydomain.com/flv/video_7.flv" desc="video_7" />
</videos>
THANKS

Lee's XML Video Playlist In AS3.0
Hello all,
First off big ups to Lee for the video tutorial which can be found here. I'm trying to convert the program to AS3.0 and am having the hardest of time. I managed to convert some pieces of it.

But still getting this error.

Code:
[TypeError: Error #1010: A term is undefined and has no properties.
at videoplayer_fla::MainTimeline/xmlLoaded()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
Here is the coding so far:

Code:
//Creates an xml object
var vlist:XML = new XML();

var XML_URL:String = "videos.xml";
var vlistURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(vlistURL);
myLoader.addEventListener("complete", xmlLoaded);
function xmlLoaded(evtObj:Event)
{
//test is data is executing
vlist = XML(myLoader.data);
trace(vlist);

var videos:Array = this.firstChild.childNodes;
//loop through all the items in the xml
for(var i=0;i<videos.length;i++) {
videoList.addItem(videos[i].attributes.desc,videos[i].attributes.url);

}

//tell xml to ignore whitespaces (always do this!)
vlist.ignoreWhitespace = true;

flvPlayback.play(videoList.getItemAt(0).data);

videoList.selectedIndex = 0;

}

var vidList:Object = new Object();

function changeHandler(event:Event):void {
flvPlayback.play(videoList.getItemAt(videoList.selectedIndex).data);
}
videoList.addEventListener(Event.CHANGE, changeHandler);
I know that the portion is AS2.0, can anyone help me convert it to 3.0? Spent nearing 5 hours on it .

Code:
var videos:Array = this.firstChild.childNodes;
//loop through all the items in the xml
for(var i=0;i<videos.length;i++) {
videoList.addItem(videos[i].attributes.desc,videos[i].attributes.url);
Before I forget, here is my xml file as well. If it helps :|

videos.xml

Code:
<?xml versdion="1.0" encoding="ISO-8859-1"?>
<videos>
<video url="videos/vid1.flv" desc="New years eve party" />
<video url="videos/vid2.flv" desc="DAv retirement" />
</videos>
Thanks!

-late

XML: Video Playlist
Hey I am a little new to AS3 and need a little help with getting videos to play correctly.

Basically I started with an XML image gallery and tweaked it a little bit to load videos instead of images. AS3 loads in thumbnails which once clicked load a video. The videos do in fact play, however they are never unloaded. So when you click on multiple thumbs, the videos begin to play on top of one another. I am also noticing sometimes the videos will not play all the way through. Any help would be appreciated. Thanks.


ActionScript Code:
var videoConnection:NetConnection = new NetConnection();
videoConnection.connect(null);
var videoStream:NetStream = new NetStream(videoConnection);
var video:Video = new Video(440, 330);
video.attachNetStream(videoStream);

var imageLoader:Loader;
var xml:XML;
var xmlList:XMLList;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("data/videos.xml"));

xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);

function xmlLoaded(event:Event):void {
    xml = XML(event.target.data);
    xmlList = xml.children();
    for(var i:int = 0; i < xmlList.length(); i++)
    {
        imageLoader = new Loader();
        imageLoader.load(new URLRequest(xmlList[i].attribute("thumb")));
        imageLoader.y = 300;
        imageLoader.x = 90 * i + 30;
        imageLoader.name = xmlList[i].attribute("source");
        addChild(imageLoader);
        imageLoader.addEventListener(MouseEvent.CLICK, loadVid);
    }
}

function loadVid(event:MouseEvent):void
{
    videoStream.play(event.target.name);
    addChild(video);
}

XML Video Playlist Help
I am trying to create a dynamic playlist for my custom flv player. I went through several different tutorials but I am having a hard time getting all the pieces to fit together. The player works, and it loads the xml file, but nothing else happens. I know I am missing some key links here. I don't use components, so I am trying to make this list from scratch, any help would be greatly appreciated.

Hers is my actionscript


ActionScript Code:
var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);

ns.setBufferTime(10);

ns.onStatus = function(info) {
    if (info.code == "NetStream.Buffer.Full") {
        player.bufferClip._visible = false;
    }
    if (info.code == "NetStream.Buffer.Empty") {
        player.bufferClip._visible = true;
    }
    if (info.code == "NetStream.Play.Stop") {
        ns.pause();
    }
};

player.theVideo.attachVideo(ns);

var time_interval:Number = setInterval(checkTime, 500, ns);
function checkTime(pf08_ns:NetStream) {
var ns_seconds:Number = pf08_ns.time;
var minutes:Number = Math.floor(ns_seconds/60);
var seconds = Math.floor(ns_seconds%60)
if (seconds<10) {
seconds = ("0"+seconds);
}
player.time_txt.text = minutes+":"+seconds+"/";
};

ns.onMetaData = function(metadata) {
    duration = metadata.duration;
    var dur_seconds:Number = duration;
    var minutes_dspl = Math.floor(dur_seconds/60);
    var seconds_dspl = Math.floor(dur_seconds%60);
    if (minutes_dspl<10) {
        minutes_dspl = ("0"+minutes_dspl);
    }
    if (seconds_dspl<10) {
        seconds_dspl = ("0"+seconds_dspl);
    }
    player.duration_txt.text = minutes_dspl+":"+seconds_dspl;
};

player.playBtn.onRollOver = function() {
    this.gotoAndPlay("Over");
};
player.playBtn.onRollOut = function() {
    this.gotoAndPlay("Out");
};
player.playBtn.onRelease = function() {
    ns.pause();
};

player.rewindBtn.onRollOver = function() {
    this.gotoAndPlay("Over");
};
player.rewindBtn.onRollOut = function() {
    this.gotoAndPlay("Out");
};
player.rewindBtn.onRelease = function() {
    ns.play("sta01.flv");
}
_root.createEmptyMovieClip("vSound", _.root.getNextHighestDepth());
vSound.attachAudio(ns);
var so:Sound = new Sound(vSound);
so.setVolume(100);
player.muteBtn.onRollOver = function() {
    if (so.getVolume() == 100) {
        this.gotoAndStop("onOver");
    } else {
        this.gotoAndStop("muteOver");
    }
};
player.muteBtn.onRollOut = function() {
    if (so.getVolume() == 100) {
        this.gotoAndStop("on");
    } else {
        this.gotoAndStop("mute");
    }
};
player.muteBtn.onRelease = function() {
    if (so.getVolume() == 100) {
        so.setVolume(0);
        this.gotoAndStop("muteOver");
    } else {
        so.setVolume(100);
        this.gotoAndStop("onOver");
    }
};

var vlist:XML = new XML();
vlist.ignoreWhite = true;

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.url);
    }
   
    ns.play(videoList.getItemAt(0).data);
    videoList.selectedIndex = 0;
}

var vidList:Object = new Object();

vidList.change = function() {
    ns.play(videoList.getItemAt(videoList.selectedIndex).data);
}

videoList.addEventListener("change",vidList);

vlist.load("videos.xml");

Video Playlist
iam getting some problems in video playlist.
plz check this link http://www.chiefexecutive.net/newsletter/videos4/video.html in thz link there is a video playlist is coming. in the playlist one "more" button is there. that more button Event is not working.

XML Video Playlist
HI,

I'm trying to make an XML video playlist and I'm getting the following error:

1000: Unable to make connection to server or to find FLV on server

The XML file, swf and videos are all in the same directory and I've checked the names to make sure.

The swf is reading the XML file fine, the descriptions from the file are showing up in the list box which is named "videoList"

here's the code:

var vlist:XML = new XML();
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);
}

ns.play(videoList.getItemAt(0).data);
videoList.selectedIndex = 0;
}

var vidList:Object = new Object();

vidList.change = function () {
ns.play(videoList.getItemAt (videoList.selectedIndex).data);
}

videoList.addEventListener("change",vidList);

vlist.load("videos.xml");


Here's the XML:

<?xml version="1.0" encoding="iso-8859-1"?>
<videos>
<video url="video1.flv" desc="Background to the Standards"/>
<video url="video2.flv" desc="The Role of the Standards"/>
<video url="video3.flv" desc="The Information and Advice Process"/>
</videos>

Hope someone can help, probably a school boy error.

Cheers,
Malcolm

XML Video Playlist
I've created an XML video playlist like the one shown in this tutorial:
http://www.adobe.com/devnet/flash/articles/prog_download.html

I was wondering how I could edit it to autoplay the first item in the list upon loading, but still have the list be completely functional. I've tried everything I can think of, but can't get it to autoplay and still work.

Thanks!

Xml Video Playlist
Hi,

I've been looking for a tutorial to make an XML video playlist, where the user clicks on a thumbnail and a video is loaded in via XML (kind of like youtube). Does anyone know of any good tutorials for this, i've been looking for ages but cant find any...i've checked the adobe site, found one but to be honest i dont understand the script (i dont want to just copy paste..)..

Any help would be great...

Ben.

Xml Video Playlist
Ok, here it goes. I have a flash video player whose playlist is based off an xml list. Now, I need this list to change based on whose accesing the player. So:

Client gets a link, clicks on link, player shows their video. Another client clicks on another link, player shows their video, etc etc.

Video Playlist
I completed the tutorial located here http://www.adobe.com/devnet/flash/articles/video_playlist.html

But now i want a playlist seperated from the video. For instance: having muliple thumnails and discriptions that are links and then when one is clicked, the main player opens in a new window.

can someone help please. maybe shoot me a tutorial or something

I want to achieve somthing like this http://www.cbsnews.com/sections/60minutes/main3415.shtml

If you click on the thumbnail it opens a new window and plays that video..

Thanks in advance.







Attach Code

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;

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("playlist.xml"));
// Format the tileList, specify its cellRenderer class.
tileList.setSize(200, 240);
tileList.columnWidth = 180;
tileList.rowHeight = 60;
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});;
}
// Select the first video.
tileList.selectedIndex = 0;
// Listen for item selection.
tileList.addEventListener(Event.CHANGE, listListener);
// 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);
}


}
}

























Edited: 05/19/2008 at 05:31:37 PM by designedfree4u

Video PlayList
Hi all,

This will probably be easy for someone who has experienced this... I did the dynamic video playlist tutorial on the site: http://www.adobe.com/devnet/flash/articles/video_player.html. It works fine on the swf but when I publish and HTML page - the page only loads the tileList but the FLV playback video doesn't even appear. Not even when I click on a selection from the tileList - what am I doing wrong?

Thanks,
Ms.Lee

Video Playlist...
I've got a bunch of flvs that are streaming (net stream) upon clicking on a link (1 - 10)... I'm trying to design it where, no matter what number you click on, it plays the following videos in sequence.

Click on Video 1 - when Video 1 finishes, it streams and then plays Video 2, then 3, 4, 5, etc.

Click on Video 5 - when Video 5 finished, it streams and then plays Video 6, 7, 8, 9, etc.

Thanks in advance!

XML Video Playlist
Hi,

I followed a tutorial on making a video playlist in Flash using XML. it's giving me the following error : "1000: Unable to make connection to server or to find FLV on server"

I know what you're thinking, but I've triple checked the file locations and it's all in the right place. A trace command is returning the correct file too.

I have a one frame swf, a video component and a list box - with the instance name "videoList"- on the stage.

NOTE: I'm running this from my hard drive, it's going to be put on CD.
I have also tried putting a URL to an online flv file in the XML.

The following code is on frame 1:


Quote:




var vlist:XML = new XML();
vlist.ignoreWhite = true;
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.url);
}

ns.play(videoList.getItemAt(0).data);
videoList.selectedIndex = 0;
}
var vidList:Object = new Object();
vidList.change = function () {
ns.play(videoList.getItemAt (videoList.selectedIndex).data);
}
videoList.addEventListener("change",vidList);
vlist.load("videos.xml");




here's what's in the XML file:


Quote:




<?xml version="1.0" encoding="iso-8859-1"?>
<videos>
<video url="video1.flv" desc="Background to the Standards"/>
<video url="video2.flv" desc="The Role of the Standards"/>
<video url="video3.flv" desc="The Information and Advice Process"/>
</videos>

XML Video Playlist
I made a video play list using XML file but now i want to know is it possible to make a video play list in which i can change my video by clicking on different images ?

like I have 10 or less than images in my flash page and I change my video every time by clicking on these images .

If it is possible then please tell me about any reference or tutorial.

If any body can ?

Thanks in advance.

XML: Video Playlist
Hey I am a little new to AS3 and need a little help with getting videos to play correctly.

Basically I started with an XML image gallery and tweaked it a little bit to load videos instead of images. AS3 loads in thumbnails which once clicked load a video. The videos do in fact play, however they are never unloaded. So when you click on multiple thumbs, the videos begin to play on top of one another. I am also noticing sometimes the videos will not play all the way through. Any help would be appreciated. Thanks.

Code:

var videoConnection:NetConnection = new NetConnection();
videoConnection.connect(null);
var videoStream:NetStream = new NetStream(videoConnection);
var video:Video = new Video(440, 330);
video.attachNetStream(videoStream);

var imageLoader:Loader;
var xml:XML;
var xmlList:XMLList;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("data/videos.xml"));

xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);

function xmlLoaded(event:Event):void {
   xml = XML(event.target.data);
   xmlList = xml.children();
   for(var i:int = 0; i < xmlList.length(); i++)
   {
      imageLoader = new Loader();
      imageLoader.load(new URLRequest(xmlList[i].attribute("thumb")));
      imageLoader.y = 300;
      imageLoader.x = 90 * i + 30;
      imageLoader.name = xmlList[i].attribute("source");
      addChild(imageLoader);
      imageLoader.addEventListener(MouseEvent.CLICK, loadVid);
   }
}

function loadVid(event:MouseEvent):void
{
   videoStream.play(event.target.name);
   addChild(video);
}

Lee's XML Video Playlist In AS3.0
Hello all,
First off big ups to Lee for the video tutorial. I'm trying to convert it the program to AS3.0 and am having the hardest of time. I managed to convert some pieces of it. But still getting this error.

TypeError: Error #1010: A term is undefined and has no properties.
at videoplayer_fla::MainTimeline/xmlLoaded()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()

Heres the coding so far.
Code:

//Creates an xml object
var vlist:XML = new XML();

var XML_URL:String = "videos.xml";
var vlistURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(vlistURL);
myLoader.addEventListener("complete", xmlLoaded);
function xmlLoaded(evtObj:Event)
{
   //test is data is executing
vlist = XML(myLoader.data);
    trace(vlist);

   var videos:Array = this.firstChild.childNodes;
   //loop through all the items in the xml
   for(var i=0;i<videos.length;i++) {
      videoList.addItem(videos[i].attributes.desc,videos[i].attributes.url);
   
}

//tell xml to ignore whitespaces (always do this!)
vlist.ignoreWhitespace = true;

flvPlayback.play(videoList.getItemAt(0).data);

videoList.selectedIndex = 0;

}

var vidList:Object = new Object();

function changeHandler(event:Event):void {
flvPlayback.play(videoList.getItemAt(videoList.selectedIndex).data);
}
videoList.addEventListener(Event.CHANGE, changeHandler);


I know that the portion
Code:

   
var videos:Array = this.firstChild.childNodes;
   //loop through all the items in the xml
   for(var i=0;i<videos.length;i++) {
      videoList.addItem(videos[i].attributes.desc,videos[i].attributes.url);


is AS2.0, can anyone help me convert it to 3.0? Spent nearing 5 hours on it . I really need to get a book haha!

Before I forget, here is my xml file as well. If it helps
videos.xml
Code:

<?xml versdion="1.0" encoding="ISO-8859-1"?>
<videos>
<video url="videos/vid1.flv" desc="New years eve party" />
<video url="videos/vid2.flv" desc="DAv retirement" />
</videos>


Thanks!

-late

Xml Video Playlist Help
Code:

okay i don't have any idea why this isn't working...i followed exactly over lee brimelows basic video tutorials, and i followed his xml video playlist tutorial, i've checked over it multiple times and watch the video many times, but i still cannot find the reason why my video's will not show up on the side...
i'll post my actionscript here to see if anyone can find the error, please help!

var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns=NetStream = new NetStream(nc);

ns.setBufferTime(10);

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);




rewindButton.onRelease = function() {
   ns.seek(0);
}

playButton.onRelease = function() {
   ns.pause();
}

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 * 171.4;
   loader.scrub._x = ns.time / duration * 171.4;
}

var scrubInterval;

loader.scrub.onPress = function() {
   clearInterval(videoInterval);
   scrubInterval = setInterval(scrubit,10);
   this.startDrag(false,-4.3,this._y,164,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/164)*duration));
}


var theMenu:ContextMenu = new ContextMenu();
theMenu.hideBuiltInItems();
_root.menu = theMenu;

var i1:ContextMenuItem = new ContextMenuItem(":':': IM Video Controls :':':",trace);
theMenu.customItems[0] = i1;

var i2:ContextMenuItem = new ContextMenuItem("Play / Pause",pauseIt,true);
theMenu.customItems[1] = i2;

var i3:ContextMenuItem = new ContextMenuItem("Replay Video",replayIt);
theMenu.customItems[2] = i3;

var i4:ContextMenuItem = new ContextMenuItem("Copyright 2007-2008 Ironic Mayhem",trace,true);
theMenu.customItems[3] = i4;

function pauseIt() {
   ns.pause();
}

function replayIt() {
   ns.seek(0);
}


var vlist:XML = new XML();
vlist.ignoreWhite = true;

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.url);
   }
   
   ns.play(videoList.getItemAt(0).data);
   videoList.selectedIndex = 0;
}

var vidList:Object = new Object();

vidList.change = function() {
   ns.play(videoList.getItemAt(videoList.selectedIndex).data);
}
videoList.addEventListener("change",vidList);

vidList.load("http://sluggo928.googlepages.com/videoplaylist.xml");

Video Playlist
I completed the tutorial located here http://www.adobe.com/devnet/flash/artic ... ylist.html

But now i want a playlist seperated from the video. For instance: having muliple thumbnails and discriptions that are links and then when one is clicked, the main player opens in a new window.

can someone help please. maybe shoot me a tutorial or something?

Thanks in advance.

Code i have so far
Code:

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;

   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("playlist.xml"));
         // Format the tileList, specify its cellRenderer class.
         tileList.setSize(200, 240);
         tileList.columnWidth = 180;
         tileList.rowHeight = 60;
         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});;
         }
         // Select the first video.
         tileList.selectedIndex = 0;
         // Listen for item selection.
         tileList.addEventListener(Event.CHANGE, listListener);
         // 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);
      }
      
      
   }
}


I want to achieve somthing like this http://www.cbsnews.com/sections/60minut ... 3415.shtml If you click on the thumbnail it opens a new window and plays that video..

XML Video PlayList
I created a 2 buttons that load a different xml playlist in the list component, but when you click on the second button it just loads it in the list without clearing the list.

coding:
videoList.addEventListener("change",vidList);

ep1btn.onRelease = function() {
vlist.load("videos.xml");
}

ep2btn.onRelease = function() {
vlist.load('videos2.xml');
}

Is there a coding that clears the previous list?

Thanks

XML VIDEO PLAYLIST
Hello, i am fairly new to these forums, im having problems with lee`s tutorial on his xml playlist. Is there any way some who has it could post up the fla or something? :roll:

This would help me out so much,
Thanks for your time
Nathan

XML Video Playlist
Ive followed the tut. for the xml video playlist and all is working but I wanted to know how to stop the flv looping.

At the moment, once a video is completed it loops. I want it just to stop. I assume this is a small piece of AS but I cant figure it out.

Can anyone help :?:

Thank you in advance.

Mitesh

Video Playlist Help
Hi all.
I have been using the XML video playlist, and wanted to add thumbnails. I tried Todd's modification, but couldn't get it to display correctly.

I then tried to modify the playlist from Adobe - videosourcepro.
I am almost there... I just can't get the video duration to display properly in a dynamic text field. I took the code from my working fla (without the thumbnails) and applied it to the videosoucepro actionscript, but that did not work. I have also tried the timecode.as from Lee's bog, and couldn't get it to work either.

Any suggestions?

The current code:
Code:

//Set up the list box, call function VideoThumb to create the actual thumbnails

list.rowHeight = 70;
list.cellRenderer = "VideoThumb";
list.selectable = true;

//create new empty listener object
listListener = {};

//Function to handle what happens when an item in the list is selected
listListener.change = function( evtobj ) {
   var nav = list.dataProvider[list.selectedIndex];
   nc = new NetConnection();          //create a connection
   nc.connect( null );               //null connection for progressive download
   ns = new NetStream(nc);          //create a stream
   video.attachVideo(ns);             //pipe stream to this video object
   // walk through the chosen item, build and play it   
   var reset = true;
   for ( var i = 0; i < nav.childNodes.length; i++ ) {
      var stream = nav.childNodes[i];
      if ( stream.nodeName == "stream" ) {
         // build path to flv, and play it
         myStreamPath = nav.attributes.url + "/" + stream.attributes.name;
         ns.setBufferTime(10);
         ns.play( myStreamPath);
         reset = false;
      }
   }
}

//Add an event listener on the list, when it triggers, run the listListener function to repopulate the list
list.addEventListener("change", listListener);


//Function that loads the XML file, parses it, and builds the list of available video clips
   var xmllist = new XML();        //setup a variable to hold the XML
   xmllist.ignoreWhite = true;
   xmllist.load( "playlist-demo-1.xml" );    //load the XML file
   //The following gets called when the XML has been loaded
   xmllist.onLoad = function( status )  {
      if ( !status )
         trace( status );
      var entries = this.childNodes[0];
      var playlists = {};
      var nav = [];
      for ( var i = 0; i < entries.childNodes.length; i++ ) {
         var entry = entries.childNodes[i];
         if ( entry.nodeName == "listitem" )
            //builds array of video clip names
            playlists[entry.attributes.name] = entry;
         else if ( entry.nodeName == "menu" ) {
            //builds array of available videos
            for ( var j = 0; j < entry.childNodes.length; j++ )
            nav[j] = playlists[entry.childNodes[j].attributes.name];
         } //end else if
      } //end if

      //sends the array of videos to the listbox UI
      list.dataProvider = nav;
   } //end xmllist.onload


//load bar
var videoInterval = setInterval(videoStatus, 100);
var amountloaded:Number;

function videoStatus() {
   amountLoaded = ns.bytesLoaded / ns.bytesTotal;
   loader.loadbar._width = amountLoaded * 310.9;
}
//End Loadbar

// Duration Text
var vidDur:Number;//Duration of the FLV
ns["onMetaData"] = function(obj) {
     vidDur = obj.duration;
}
function checkTime(ns:NetStream,duration:TextField) {
    var ns_seconds:Number = ns.time;
    var minutes:Number = Math.floor(ns_seconds/60);
    var seconds = Math.floor(ns_seconds%60);
    var vidminutes:Number = Math.floor(vidDur/60);
    var vidseconds = Math.floor(vidDur%60);
    if (vidseconds<10) {
       vidseconds = "0"+vidseconds;
    }
    if (seconds<10) {
    seconds = "0"+seconds;
    }
    durText.text = minutes+":"+seconds+" / "+vidminutes+":"+vidseconds;
}
var time_interval:Number = setInterval(checkTime, 60, ns,duration);
//End Duration Text


//resizes the video object to the width and height of the clip
function onVideoResize() {
   if ( video.width != video._width || video.height != video._height ) {
      video._width = video.width;
      video._height = video.height;
      //center video in playback area
      newx = (460 - video._width)/2;
      newy = (470 - video._height)/2;
      video._x = newx;
      video._y = newy;
   }
}
setInterval( onVideoResize, 200 ); //keeps checking video size


Thumbnail code:

Code:


class VideoThumb extends mx.core.UIComponent
{
   static var symbolName = "VideoThumb";
   var label : Object;      // the new text label we'll use
   var listOwner : Object; // reference to the tree - supplied by the tree
   var thumb;
   var nc;               // NetConnection
   var ns;               // NetStream
   var streamurl;
   
   function VideoThumb()
   {
      // nothing needed - we're extending v2;
   }

   function init()
   {
      // nothing needed - we don't have any instance variables to initialize
   }

   function createChildren(Void) : Void
   {
      // attachMovie (linkageID, new name, depth)
      var v = this.attachMovie( "VideoHolder", "thumb", 0 );
      v._width = 80;
      v._height = 60;
      v.styleName = listOwner;

      var c = createLabel("label", 1);
      
      c.styleName = listOwner;
      c.selectable = false;
   }

   // pass all sizing from the tree to the cell
   function size(Void) : Void
   {
      label.setSize(label.getPreferredWidth(),label.getPreferredHeight());
      label._x = thumb._width + 10;
      label._y = thumb._height/2 - label._height/2;
   }

   // str is the suggested string to render from the tree (based on the node)
   // node is the entire XMLNode for the row
   // sel is the selected state (not usually used)
   function setValue(str : String, item, sel)
   {
      _visible = item != undefined;
      if ( !_visible )
         return;
      
      label.setValue( item.attributes.name );
      //trace(item.attributes.name);
      // Thumbnail is picked up as the first frame of the playlist
      var url = item.attributes.url;
      var stream = item.attributes.thumb;
      var start = item.attributes.thumbpos;
            
            //grab jpg thumbnail instead of initiating stream as shown commented out above.
      var newClip = this.createEmptyMovieClip("thumbie",this.getNextHighestDepth());
      newClip.loadMovie("thumbs/"+stream);
      
      // If explicit thumb is not specified use the
      // start frame of the first stream
      if ( stream == undefined ) {
         stream = item.childNodes[0].attributes.name;
         start = item.childNodes[0].attributes.start;
      }
      
      // Give up if we still don't have valid thumb info
      if ( stream == undefined )
         return;

      // Render the thumbnail only if necessary
      if ( streamurl == url + "/" + stream )
         return;
      
      streamurl = url + "/" + stream;
      //trace( streamurl );
      trace( stream );
      
      //nc = new NetConnection();
//nc.onStatus = function( info ) { trace( info.code ); }
      //nc.connect( null );
      
      //ns = new NetStream(nc);
      //ns.onStatus = function(info) {
         //if ( info.code == "NetStream.Play.Stop" ) {
            //nc = null;
            //ns = null;
         //}
      //}
      //ns.connect();
      //ns.play( stream, start, 0 );
      //ns.play( streamurl );
      //ns.seek(2);
      //ns.pause();
      

   }

   // ensures the cell is centered vertically properly - luckily, the label also implements this method.
   function getPreferredHeight()
   {
      return 60;
   }

   function getPreferredWidth()
   {
      return label.getPreferredWidth();
   }
}


Jay

Xml Video Playlist
i followed lee's tutorial for the xml video playlist and it all worked great!!
but i want to add thumbnails of the videos to the list as well (either JPEGS from a folder or some sort of way to capture the videos first frame)

if anyone knows what should i change in lee's XML file and flash file of that tutorial in order to add thumbnails to the list, i would be extremely happy

Dynamic Video And Playlist Using XML
I am in desperate need of help. Im trying to build a Video Player that gets its playlist from an XML file and loads the .swf's into a target movie holder. I've attached my simple xml data. basically i want "title" to display as text in a playlist and "movie" to load into target empty MC in my flash doc when the item is selected in the playlist. If you can help i'd appreciate it and i can send source files if it helps. thanks.

Duration Of Video Playlist In FMS
I am currently working on a project that uses FMS playlists and cant seem to find out where I can get the total duration of the playlist. When using playlists on FMS you will get the duration for each clip in the onMetadata, only the _stream.time(); is based on the playlist time. This results in the messup of my controller because here I only have the duration of a single clip. Seeing that FMS supports dynamic playlists I can understand that the total duration of the playlist is variable, which makes it hard to tell what the playlist duration and current time is. Has anyone worked with this before?

Dynamic Video Playlist
Hi, I am new to Actionscript 3 and I have followed the tutorial regarding creating a dynamic video playlist with thumbnails. I created as the tutorial said and it worked fine. Instead of their just being a title for a video, I have also tried to add a description to each tileitem, but instead the title repeats twice. Can anyone see where i'm going wrong? You can view my playlist here - www.coolmustard.co.uk/VideoPlaylist.html

Thumb actionscript file:
package {
import fl.controls.listClasses.ICellRenderer;
import fl.controls.listClasses.ImageCell;
import fl.controls.TileList;
import flash.text.*;

public class Thumb extends ImageCell implements ICellRenderer {
private var desc:TextField;
private var info:TextField;
private var textStyle:TextFormat;

public function Thumb() {
super();

loader.scaleContent = false;
useHandCursor = true;

// set skins
setStyle("upSkin", ThumbCellBg);
setStyle("downSkin", ThumbCellBg);
setStyle("overSkin", ThumbCellBgOver);

setStyle("selectedUpSkin", ThumbCellBgOver);
setStyle("selectedDownSkin", ThumbCellBgOver);
setStyle("selectedOverSkin", ThumbCellBgOver);

// Create and format desc
desc = new TextField();
desc.autoSize = TextFieldAutoSize.LEFT;
desc.x = 80;
desc.y = 4;
desc.width = 500;
desc.multiline = true;
desc.wordWrap = true;
addChild(desc);

textStyle = new TextFormat();
textStyle.font = "Arial";
textStyle.color = 0xffffff;
textStyle.size = 11;
textStyle.bold = true;

info = new TextField();
info.autoSize = TextFieldAutoSize.LEFT;
info.x = 80;
info.y = 15;
info.width = 500;
info.multiline = true;
info.wordWrap = true;
addChild(info);
}

override protected function drawLayout():void {
// Position cell elements; tweak these for your thumbs if needed
var imagePadding:Number = getStyleValue("imagePadding") as Number;
loader.move(11, 8);

var w:Number = width-(imagePadding*2);
var h:Number = height-(imagePadding*2);

if (loader.width != w && loader.height != h) {
loader.setSize(w,h);
}

loader.drawNow();

desc.text = data.label;
desc.setTextFormat(textStyle);

info.text = data.label;
info.setTextFormat(textStyle);

background.width = width+5;
background.height = height+2;
textField.visible = false;
}
}
}

Videoplaylist actionscript code:
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;

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("playlist.xml"));
// Format the tileList, specify its cellRenderer class.
tileList.setSize(600, 240);
tileList.columnWidth = 580;
tileList.rowHeight = 60;
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(), label:item.attribute("info").toXMLString(),
data:item.attribute("src").toXMLString(),
source:thumb});;
}
// Select the first video.
tileList.selectedIndex = 0;
// Listen for item selection.
tileList.addEventListener(Event.CHANGE, listListener);
// And automatically load it into myVid.
myVid.source = tileList.selectedItem.data;
// Pause video until selected or played.
myVid.play();
}


// Detect when new video is selected, and play it
function listListener(event:Event):void {
myVid.play(event.target.selectedItem.data);
}


}
}

XML Playlist:
<?xml version="1.0" encoding="UTF-8"?>
<playlist id="Adobe Developer Center - Dynamic Video Playlist in AS3" >
<vid desc="Champneys Spa's and Resorts"
info="Enter a short description here"
src="

Loop A Video Playlist
I have found this excellent flash playlist using AS3:
http://www.adobe.com/devnet/flash/articles/video_playlist.html

And I would like to make a loop so when the last video is done it will play the first video again. Unfortunatley I don't have the time to use many more days. So I bring the script here in the hope someone can make the loop. Thanks for your help

AS3 script:
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 fl.video.VideoEvent;

public class VideoPlaylistSeq extends MovieClip {
private var xmlLoader:URLLoader;

public function VideoPlaylistSeq():void {
// Load the playlist file, then initialize the media player.
xmlLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, initMediaPlayer);
xmlLoader.load(new URLRequest("playlist.xml"));
// Format the tileList, specify its cellRenderer class.
tileList.setSize(200, 240);
tileList.columnWidth = 180;
tileList.rowHeight = 60;
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});;
}
// Select the first video.
tileList.selectedIndex = 0;
// Listen for item selection.
tileList.addEventListener(Event.CHANGE, listListener);
// And automatically load it into myVid.
myVid.source = tileList.selectedItem.data;
// Pause video until selected or played.
//myVid.pause();
// Listen for end of current video, then play the next
myVid.addEventListener(VideoEvent.COMPLETE, vidComplete);
}

// Detect when new video is selected, and play it
function listListener(event:Event):void {
myVid.play(event.target.selectedItem.data);
}

// listen for complete event; play next video
function vidComplete(eventObject:VideoEvent):void {
if(tileList.selectedIndex < tileList.length-1){
tileList.selectedIndex = tileList.selectedIndex+1;
tileList.scrollToIndex(tileList.selectedIndex);
myVid.play(tileList.selectedItem.data);
}
};
}
}

Video Playlist And Thumbnails
Ok for those with patients, here is what I’m trying to do: I just want to have a video player which can play flv files when a corresponding thumbnail is clicked. I have already compressed the flv files and gone through several tutorials but I can’t seem to get it. I’m relatively new to flash and can do all of the simple things, but even the Total Training video “Advanced Macromedia Flash Actionscript” barely glances over building a playlist. I tried to do it with XML but failed again. One problem is that I am using the video component and as I understand it, it must reside in the first frame of the video. Is there a way around this because I have a whole intro that plays first?

If you want to do thumbnails, do you still use XML? I have read this tutorial,
http://www.adobe.com/devnet/flash/ar...eo_player.html
but it didn’t really help either. Perhaps someone could help me or point me in the right direction. Here is my XML for the listbox in case anyone sees any glaring errors.

<?xml version="1.0" encoding="iso-8859-1"?>

<videos>
<Add name="Noggin">
<path>Lavskymusic Videos/Noggin-Halloween320x240High ATT.flv</path>
</Add>
<Add name="AT&T">
<path>Lavskymusic Videos/AT&T-Baby Tiger-Japanese320x240High ATT.flv</path>
</Add>
<Add name="KCBS">
<path>Lavskymusic Videos/KCBS-Station of the People320x240High ATT.flv</path>
</Add>
<Add name="Kodak">
<path>Lavskymusic Videos/Kodak-Dracula2320x240High ATT.flv</path>
</Add>
<Add name="NY Lotto">
<path>Lavskymusic Videos/NY Lotto-Boardroom2320x240High ATT.flv</path>
</Add>
<Add name="OTB">
<path>Lavskymusic Videos/OTB By Phone-2320x240High ATT.flv</path>
</Add>
<Add name="Pepsi">
<path>Lavskymusic Videos/Pepsi-Sound Truck320x240High ATT.flv</path>
</Add>
<Add name="Reebok">
<path>Lavskymusic Videos/Reebok-'Kick'2320x240High ATT.flv</path>
</Add>
<Add name="Ritz">
<path>Lavskymusic Videos/Ritz - Flowers320x240High ATT.flv</path>
</Add>
<Add name="Saturn">
<path>Lavskymusic Videos/Saturn - H&G320x240High ATT.flv</path>
</Add>
<Add name="VH-1">
<path>Lavskymusic Videos/VH-1320x240High ATT.flv</path>
</Add>
<Add name="Volkswagen">
<path>Lavskymusic Videos/Volkswagen-GL320x240High ATT.flv</path>
</Add>
<Add name="Walmart">
<path>Lavskymusic Videos/Walmart - Soccer1320x240High ATT.flv</path>
</Add>
</videos>

XML Video Playlist Question
How do I make the XML-playlist video player automatically switch to the next video instead of same video looping over and over?

Code:

var vlist:XML = new XML();
vlist.ignoreWhite = true;

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.url);
   }
   
   ns.play(videoList.getItemAt(0).data);
   videoList.selectedIndex = 0;
}
   
var vidList:Object = new Object();

vidList.change = function() {
   ns.play(videoList.getItemAt(videoList.selectedIndex).data);
}



I appreciate any help.

XML Video Playlist Info
I've followed the flash tutorials online on how to create an XML based playlist and have that up and working wonderfully. I would like to add an information box, similar to the "Now Playing" box of this site to pull out the title, time, external links, etc.

Can anyone point me in the right direction?

Video Playlist With Tree
Hi,
Can anyone enlighten me as am new to flash- I'm trying to use the tree as a playlist for videos, but can't seem to get it going. Seeing as my knowledge of flash is quite limited, can someone please explain how this can be done?
Thanks.

Help With The XML Video Playlist Tutoral
Hi,

I went along with the XML video playlist tutoral and I can't get the xml information to do anything, the playlist is blank and the video just blinks "buffering". Just to check thing's out I changed the path to my xml file and it gave me an error so I know the original path I was using is correct. I also changed the buffer down to 1 second to see if that could help But still nothing in the playlist. I'm using Flash 8 Pro. The video list is a list object called videoList and I named it's instance videoList

This is a sample of the xml created in dreamweaver
Code:

<?xml version="1.0" encoding="iso-8859-1"?>
<videos>
   <video url="intro.flv" desc="Homes" />
   <video url="home1.flv" desc="VANDERBILT" />
   <video url="home2.flv" desc="LOWERY" />
   <video url="home3.flv" desc="HADDINGTON" />
   <video url="home4.flv" desc="CYPRESS" />
   <video url="home5.flv" desc="HOLBROOK" />
   <video url="home6.flv" desc="DUG HILL RD" />
   <video url="home7.flv" desc="CLIFFS EDGE" />
</videos>

and this is the action script that is looking at the xml
Code:

var vlist:XML = new XML();
vlist.ignoreWhite = true;

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

var vidList:Object = new Object();

vidList.change = function() {
   ns.play(videoList.getItemAt(videoList.selectedIndex).data);
}

videoList.addEventListener("change",vidList);

vlist.load("videos.xml");

I have all files sitting in the same folder so I'm sure it's not a path issue. It might be a typ-o but I don't see it if there is one.

Thanks for any help.

XML MP3 Player Like The 'XML Video Playlist'
Hi,

How would I create an XML MP3 player like the 'video playlist' tutorial, I have had a play around with it but can't get it to play the *.mp3 files. + would there be a way of getting the meta data from the MP3's to be displayed in a now playing box (scrolling through the data)

Thanks for any help, Great tutorials by the way!

XML Video Playlist Not Working
I've been working the last few days trying to figure out what I've done wrong with the XML that it is not loading. I completed the Video Basic series by creating the player, creating the net connection and net stream, control buttons and included flv's to play.

Then I completed the XML video playlist tutorial and have not been able to get that to work.

Here is the url:
http://www.silverwoodstudiosonline.com/ ... t6Try.html
click on "hot gallery" on the navigational bar at the bottom.

Here is the code for the page including the video player and all the control buttons. You can jump right to where it says:
//---START Video XML List

Code:

var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);

ns.setBufferTime(5);

ns.onStatus = function(info) {
   if(info.code == "NetStream.Buffer.Full") {
      bufferClip._visible = false;
   }
   if(info.code == "NetStream.Buffer.Empty") {
      bufferClip._visible = true;
   }
   //this will load the next video in line with function below
   if(info.code == "NetStream.Play.Stop") {
      myInt = setInterval(loadNext,1000);
   }
}
function loadNext() {
   clearInterval(myInt);
   ns.play("Michael2.flv");
}

theVideo.attachVideo(ns);

ns.play("MenOnStage.flv");

//------------------Buttons ------------------

rewindButton.onRelease = function() {
   ns.seek(0);
}

playButton.onRelease = function() {
   ns.pause();
}

//--------------- loader bar - not working
var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;

function videoStatus() {
   amountLoaded = ns.bytesLoaded / ns.bytesTotal;

   loader.loadbar.width = amountLoaded * 195.0;
}


////---------------mute button--------------

_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");
   }
}
//-------------- END mute Button -------------------

//-----------------------------START Video XML List--------------------------

var vList:XML = new XML();
vList.ignoreWhite = true;

vList.onLoad = function() {
   var videos:Array = this.firstChild.childNodes;
   //iterate through the video array
   for (i=o;i<videos.length;i++) {
      videoList.addItem(videos[i].attributes.desc,videos[i].attributes.url);
   }
   ns.play(videoList.getItemAt(0).data);
   videoList.selectedIndex = 0;   
}

var vidList:Object = new Object();

vidList.change = function() {
   ns.play(videoList.getItemAt(videoList.selectedIndex).data);
}
videoList.addEventListener("change", vidList);

vlist.load("videos.xml");
//---------------------END XML Video List


Then here is the XML code:
Code:

<?xml version="1.0" encoding="ISO-8859-1"?>

<videos>
   <video url="http://www.silverwoodstudiosonline.com/Test/MenOnStage.flv" desc="Introduction" />
   <video url="http://www.silverwoodstudiosonline.com/Test/Michael1.flv" desc="Candle Lighting" />
   <video url="http://www.silverwoodstudiosonline.com/Test/Michael2.flv" desc="Hora" />
</videos>

NOTHING POPULATES THE LIST COMPONENT and I can't figure out why.
You will see in the actionscript code that I have ns.play up there which is now playing the video. I tried taking that out thinking that was interfering with the ns.play within the XML list script, but then nothing played.

Does anything look wrong. I watched all the videos over to see if I could see anything wrong, but I didn't. Thanks for any help !!! [/code]

XML Video Playlist With Images?
Hi guys,

In the “Tutorial archives” window on the gotoAndLearn main site you can see little Flash icons. Now I was wondering, is it possible to make a video playlist with images? Little thumbnails / screenshots of the movies in the list. Can that be done with XML?
If so, do you have the codes / scripts for it? Or an example file? I don’t know much about actionscript and codes. I’ve made the videoplayer with the XML video playlist with Lee’s tutorials.

Lee's XML Video Playlist & FLASHSTREAMWORKS.COM
Hi

Anyone hwo now if it's possible to use this player http://www.flashstreamworks.com/flvplayerweb/index.php with Lee's XML video Playlist?

Making A Flash Video Playlist
Could it be possible to make some kind of playlist in flash professional 8 using .flv files?

XML Video Player...modify The Playlist
The current play list is a compnenet in Flash that is populated by an XML file

it works fine but I would like to create a playlist that i can customize to match the site that I am working on.

any thoughts on how to set up a XML playlist

Ponyack

XML Video Playlist Follow Up Question
Is there a way to create a XML video Playlist that does not use the list box component?

I have done a search on the net and all the tutorials I have seen use the component.

Thanks

Ponayck

[F8] Multi XML Playlist In Video Player
I have a xml driven playlist, how can I make it so i can have multible playlists that will be linked to a button in flash. Here is an example of the player on my server www.palsmediagroup.com as you can see the buttons News Weather Sports need to be linked to a seperate playlist.

I shure could use some help on this.

Here is the XML code

<?xml version="1.0"?>
<videos>
<video>
<title><![CDATA[<img src='thumbs/esa_welcome.jpg' hspace='0' vspace='2'>&nbsp;<span class='videoTitle'>Intro <br>&nbsp;Site Intro</span><br>&nbsp;<span class='colons'>Length:</span><span class='videoDescription'> 10 sec</span>]]></title>
<file><![CDATA[http://components.earthscienceagency.com/sw_includes/videos/Component_Intro2.flv]]></file>
<link><![CDATA[http://components.earthscienceagency.com/]]></link>
</video>
<video>
<title><![CDATA[<img src='thumbs/esa_sample.jpg' hspace='0' vspace='2'>&nbsp;<span class='videoTitle'>Sunset<br>&nbsp;Sample Video</span><br>&nbsp;<span class='colons'>Length:</span><span class='videoDescription'> 10 sec</span>]]></title>
<file><![CDATA[http://components.earthscienceagency.com/sw_includes/videos/Sunset.flv]]></file>
<link><![CDATA[http://reviewjournal.com//]]></link>
</video>
<video>
<title><![CDATA[<img src='thumbs/esa_components.jpg' hspace='0' vspace='2'>&nbsp;<span class='videoTitle'>Pool<br>&nbsp;Sample Video</span><br>&nbsp;<span class='colons'>Length:</span><span class='videoDescription'> 13 sec</span>]]></title>
<file><![CDATA[http://components.earthscienceagency.com/sw_includes/videos/Pool.flv]]></file>
<link><![CDATA[http://components.earthscienceagency.com/components/]]></link>
</video>
<video>
<title><![CDATA[<img src='thumbs/esa_sample.jpg' hspace='0' vspace='2'>&nbsp;<span class='videoTitle'>Smoke<br>&nbsp;Sample Video</span><br>&nbsp;<span class='colons'>Length:</span><span class='videoDescription'> 29 sec</span>]]></title>
<file><![CDATA[http://components.earthscienceagency.com/sw_includes/videos/Smoke.flv]]></file>
<link><![CDATA[http://components.earthscienceagency.com/components/]]></link>
</video>
<video>
<title><![CDATA[<img src='thumbs/esa_components.jpg' hspace='0' vspace='2'>&nbsp;<span class='videoTitle'>Green Blob<br>&nbsp;Sample Video</span><br>&nbsp;<span class='colons'>Length:</span><span class='videoDescription'> 18 sec</span>]]></title>
<file><![CDATA[http://components.earthscienceagency.com/sw_includes/videos/Green_Blob.flv]]></file>
<link><![CDATA[http://components.earthscienceagency.com/components/]]></link>
</video>
<video>
<title><![CDATA[<img src='thumbs/esa_sample.jpg' hspace='0' vspace='2'>&nbsp;<span class='videoTitle'>Clouds<br>&nbsp;Sample Video</span><br>&nbsp;<span class='colons'>Length:</span><span class='videoDescription'> 14 sec</span>]]></title>
<file><![CDATA[http://components.earthscienceagency.com/sw_includes/videos/Clouds.flv]]></file>
<link><![CDATA[http://components.earthscienceagency.com/components/]]></link>
</video>
</videos>

Dynamic Video Playlist Using XML (Flash 8)
Hello all, this is driving me crazy, I got no help in the 'Flash Video' forum, so I thought I'd relocate it since I suppose it's really an Actionscriptissue..

I'm using the tutorial that Lisa Larson-Kelley wrote some time ago about using XML and Actionscript to create a dynamic playlist inside of Flash.

The link can be found here. And I think I've attached the files.

I love it and it works great, but I need to add playback controls to the video that it pulls in any ideas?

Lee Brimelow's XML Video Playlist Tutorial
I'm trying to get Lee's code to work to no avail, does anyone see where I'm making a mistake? I belive is the XML part because the player works with
ns.play("http://mysite.com/sample.flv");(gets deleted by Lee to get items XML loaded)
This is the code:
*****************

var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);

theVideo.attachVideo(ns);

ns.setBufferTime(10);

ns.onStatus = function(info) {
trace(info.code);
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);
}
}



playButton.onRelease = function() {
ns.pause();
}

rewindButton.onRelease = function() {
ns.seek(0);
}

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 * 208.9;
loader.scrub._x = ns.time / duration * 208.9;
}

var scrubInterval;

loader.scrub.onPress = function() {
clearInterval(videoInterval);
scrubInterval = setInterval(scrubit,10);
this.startDrag(false,0,this._y,208,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/208)*duration));
}

var theMenu:ContextMenu = new ContextMenu();
theMenu.hideBuiltInItems();
_root.menu = theMenu;

var item1:ContextMenuItem = new ContextMenuItem("::::: Video Controls :::::",trace);
theMenu.customItems[0] = item1;

var item2:ContextMenuItem = new ContextMenuItem("Play / Pause Video",pauseIt,true);
theMenu.customItems[1] = item2;

var item3:ContextMenuItem = new ContextMenuItem("Replay the Video",restartIt);
theMenu.customItems[2] = item3;

var item4:ContextMenuItem = new ContextMenuItem(" 2005 Lee Brimelow",trace,true);
theMenu.customItems[3] = item4;

function pauseIt() {
ns.pause();
}

function stopIt() {
ns.seek(0);
ns.pause();
}

function restartIt() {
ns.seek(0);
}

var vlist:XML = new XML();
vlist.ignoreWhite=true;

vlist.onLoad = function() {
var videos:Array = this.firstChild.childNodes;
for(i=0;i<videos.lenght;i++){
videoList.addItem(videos[i].attributes.desc,videos[i].attributes.url);
}

ns.play(videoList.getItemAt(0).data);
videoList.selectedIndex = 0;
}

var vidList:Object = new Object();

vidList.change = function() {
ns.play(videoList.getItemAt(videoList.selectedInde x).data);
}

videoList.adddEventListener("change",vidList);

vlist.load("videos.xml");
************
XML is as per Lee, List has Instance -videoList_and all are in the same directory.Thanks

Video Player And XML Playlist Problems
I have created a video player to house 4 different categories of videos. The categories are each represented by a button. The player sits to the left of the four buttons and to the right of the four buttons is the list of videos for each category.

I want to have it so that each button loads a different XML playlist (in the area to their right) when clicked.

I have the buttons loading each new playlist, but they are not clearing out the previous playlists so the new lists are just being added to the bottom of the list.

In addition when the video is playing and you click on a new category the video stops and I would like it to keep playing until a new video is selected from the playlist.

I know that there is something that I am just not seeing here and I need a fresh set of eyes. Please help!

Thanks!

Here is my code:


ActionScript Code:
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;

   
   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("playlist-streaming.xml"));
      
      
      FeaturedVidButt_btn.addEventListener(MouseEvent.MOUSE_UP, loadMe);
      function loadMe (e:MouseEvent)
      {
      xmlLoader.load(new URLRequest("playlist-streaming.xml"));
      }
      
      v21Button_btn.addEventListener(MouseEvent.MOUSE_UP, loadMeTwo);
      function loadMeTwo (e:MouseEvent)
      {
      xmlLoader.load(new URLRequest("playlist-streaming-2_1.xml"));
      }  
      
      LowEnergyButton_btn.addEventListener(MouseEvent.MOUSE_UP, loadMeThree);
      function loadMeThree (e:MouseEvent)
      {
      xmlLoader.load(new URLRequest("playlist-streaming-LowEnergy.xml"));
      }  
      
      IconsButton_btn.addEventListener(MouseEvent.MOUSE_UP, loadMeFour);
      function loadMeFour (e:MouseEvent)
      {
      xmlLoader.load(new URLRequest("playlist-streaming-Icons.xml"));
      }
      // Format the tileList, specify its cellRenderer class.
      theList.setSize(170, 315);
      theList.columnWidth = 155;
      theList.rowHeight = 140;
      theList.direction = ScrollBarDirection.VERTICAL;
      theList.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.
      theList.addItem({label:item.attribute("desc").toXMLString(),
      data:item.attribute("src").toXMLString(),
      source:thumb});;
   }
   // Listen for item selection.
   theList.addEventListener(Event.CHANGE, listListener);
   // Select the first video.
   theList.selectedIndex = 0;
   // And automatically load it into myVid.
   myVid.source = theList.selectedItem.data;
   // Pause video until selected or played.
   myVid.pause();
   // Listen for buttons selected

   
}

// Detect when new video is selected, and play it
      function listListener(event:Event):void {
         myVid.play(event.target.selectedItem.data);
      }
   }
}

Overlay The Playlist In A FLV Video Player
I'd like to add a button in my FLV video player that when pressed will bring up a playlist component that is positioned on top of the video player component. Clicking the button again would remove the playlist. I'm using Flash 8, so ActionScript 2 for now. Can someone point me in the right direction in terms of how I would program that button?

Thanks,

Tom Wood
Wendel Brume





























Edited: 10/13/2008 at 08:35:04 AM by tomwood2

Copyright 2005-08 www.BigResource.com, All rights reserved