From: smillerd on
I recently went through a tutorial by Lee Brimelow on Flash Video. It was an
excellent tutorial for me, as I don't know a thing about Actionscript. I
followed the instructions and typed the code and all worked well. Until I added
a video play list, using a XML file. The tutorial told how to make a buffering
screen to show that the video was indeed downloading. However, When I added the
play list, the only video that shows the buffering screen is the first one. The
others won't show.

I was told that I needed to " try putting some extra code in the "change"
method of the list
component. So basically whenever you click an entry it would set the
_visible property of your buffer clip to true."

As I mentioned, I don't know anything about Actionscript, but am trying to
learn. My question is actually two- how could I figure out what "extra code" is
needed, and where is a good source (on the internet) to get a foundation for
ActionScript. ? I have no programing experience at all.

Thanks for any direction or insight.

Steve Miller

P.S. Below is the current code I am using-

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


skyclub.attachVideo(ns);



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

var scrubInterval;

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

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",replayIt);
theMenu.customItems[2] = i3;

var i4:ContextMenuItem = new ContextMenuItem("Copyright 2005 Mockingbird
Properties",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.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("video.xml");