Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 10-30-2007, 01:12 AM   #1
weisswolfen
Registered User
 
Join Date: Jul 2006
Posts: 7
Default 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
weisswolfen is offline   Reply With Quote
Old 10-30-2007, 01:32 AM   #2
atomic
Banned by AS.org Staff
 
Join Date: Jan 2007
Location: Montréal, Québec
Posts: 14,075
Default

Attach your .fla & .xml file.
atomic is offline   Reply With Quote
Old 10-30-2007, 05:08 PM   #3
weisswolfen
Registered User
 
Join Date: Jul 2006
Posts: 7
Default I got it done with few changes

These are the changes:

// xml playlist
// create an XMl object
var vidList:XML = new XML();
// ignore white spaces
vidList.ignoreWhite = true;
vidList.onLoad = function() {
// put the nodes of xml into array
var videoArray:Array = this.firstChild.childNodes;
// iterate through video array
// and add videos to the listbox
for (var i = 0; i<videoArray.length; i++) {
videoList.addItem(videoArray[i].attributes.desc, videoArray[i].attributes.url);
}
// when xml is loaded play first item
ns.play(videoList.getItemAt(0).data);
// highlight first video in listbox
videoList.selectedIndex = 0;
};
// create a listener that responds
// to changes in the listbox
var vidListener:Object = new Object();
vidListener.change = function() {
// play the item selected in listbox
ns.play(videoList.getItemAt(videoList.selectedInde x).data);
};
// register the event listener to listbox
videoList.addEventListener("change", vidListener);
// load xml file
vidList.load("videos.xml");
weisswolfen is offline   Reply With Quote
Old 10-30-2007, 06:12 PM   #4
atomic
Banned by AS.org Staff
 
Join Date: Jan 2007
Location: Montréal, Québec
Posts: 14,075
Default

One's never better served than by one's self!
atomic is offline   Reply With Quote
Old 10-13-2008, 10:54 AM   #5
janebush08
Registered User
 
Join Date: May 2008
Posts: 10
Default

i don't see any mistake.... this error is serious one...
janebush08 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Square box (not rounded) for video chat application artane Flash Media Server 5 11-29-2008 03:02 AM
Dynamic Playlist Help... Gaffer ActionScript 2.0 0 09-27-2007 03:00 AM
Interested in a free Flash video tutorial??? Filipinho Other Flash General Questions 4 07-01-2002 02:41 AM
Free Flash video tutorial??? Filipinho Simple Stuff (Newbies) 3 06-30-2002 08:58 AM


All times are GMT. The time now is 05:55 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.