i’ve been toying with this for hours, and it’s driving me nuts! i downloaded the gotoandlearn.com source code from [URL=“http://theflashblog.com/?p=46”]the flash blog, and after tinkering around with it some i still can’t seem to get the videos to load. everything else works fine… the menu items display, the descriptive text displays… but no video!
//======================================================
//===================VIDEO SETUP=======================
//======================================================
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(10);
theVideo.attachVideo(ns);
ns.onStatus = function(obj) {
if(obj.code.indexOf("Stop")!=-1) {
pr._x = pstart;
ns.seek(0);
}
if (obj.code == "NetStream.Buffer.Full") {
buffclip._visible = false;
}
if(obj.code == "NetStream.Buffer.Empty") {
buffclip._visible = true;
}
}
//======================================================
//======================================================
//===================LIST BOX===========================
//======================================================
var tl = tutorialList.tutList;
tl.setStyle("color", 0x000000);
tl.setStyle("rollOverColor",0xE3E3E3);
tl.setStyle("backgroundColor", 0xFFFFFF);
tl.setStyle("textRollOverColor",0x000000);
tl.setStyle("textSelectedColor",0x000000);
tl.setStyle("selectionColor",0xE3E3E3);
tl.setStyle("fontFamily","arial");
tl.setStyle("fontSize",11);
tl.setStyle("embedFonts",false);
var listlist:Object = new Object();
var lsound:Sound = new Sound();
lsound.attachSound("been");
listlist.itemRollOver = function(obj) {
if(obj.index < vidArr) {
infoTip.info.text = _root["tut"+obj.index].desc;
infoTip._x = _root._xmouse;
infoTip._y = _root._ymouse;
infoTip._visible = true;
infoTip.onMouseMove = function() {
this._x = _root._xmouse;
this._y = _root._ymouse;
}
lsound.start();
}
}
listlist.itemRollOut = function() {
delete infoTip.onMouseMove;
infoTip._visible = false;
}
listlist.change = function() {
//if(tl.selectedIndex < vidArr) {
//ns.close();
np.timetext.text = "Loading File...";
playtime(_root["tut"+tl.selectedIndex].url);
np.info.text = _root["tut"+tl.selectedIndex].desc;
np.title.text = _root["tut"+tl.selectedIndex].title;
//}
}
tl.addEventListener("itemRollOut",listlist);
tl.addEventListener("itemRollOver",listlist);
tl.addEventListener("change",listlist);
//==========================================================
//======================================================
//===================XML PARSING=======================
//======================================================
var x:XML = new XML();
x.ignoreWhite = true;
var vidArr:Number = 0;
Tutorial = function(title, url, desc) {
this.title = title;
this.url = url;
this.desc = desc;
};
x.onLoad = function() {
var videos = this.firstChild.childNodes;
for(i=0;i<videos.length;i++) {
tl.addItem(videos*.attributes.title,videos*.attributes.url);
_root["tut"+i] = new Tutorial(videos*.attributes.title,e,videos*.attributes.desc);
vidArr++;
}
np.title.text = tut0.title;
np.info.text = tut0.desc;
//ns.play(tl.getItemAt(0).data);
playtime(tut0.url);
tl.selectedIndex = 0;
}
//x.load("videos.xml");
x.load("videos.xml");
//======================================================
//==========================================================
//====================VIDEO CONTROLS======================
//==========================================================
function playtime(who) {
ns.play(who);
loadInt = setInterval(loadFunction,50);
buffclip._visible = true;
}
var scr = _root.controlBar.scrubber;
var pr = scr.progres;
var ld = scr.loader;
var cb = _root.controlBar;
var pl = scr.perload;
var swidth = scr.back._width;
var pstart = pr._x;
var dur:Number;
ns["onMetaData"] = function(obj) {
dur = obj.duration;
np.timetext.text = Math.floor(dur/60) + " minutes, " + Math.round(dur%60) + " seconds";
}
_root.onEnterFrame = videoUpdate;
var loadInt = setInterval(loadFunction,50);
function loadFunction() {
var lprog = ns.bytesLoaded / ns.bytesTotal;
if(lprog < 1) {
pl._x = ld._x + ld._width - 20;
pl.perload.text = Math.round(lprog * 100) + "%";
pl._visible = true;
ld._width = swidth * lprog;
}
else {
pl._visible = false;
ld._width = swidth;
clearInterval(loadInt);
}
}
function videoUpdate() {
var prog = ns.time / dur;
pr._x = -258.5 + (swidth * prog);
/*if(prog > 0.99) {
pr._x = pstart;
ns.seek(0);
ns.pause(true);
clearInterval(vidInterval);
cb.plabel.gotoAndStop(2);
}*/
}
cb.replayer.onRollOver = function() {
showTip(" Replay Video");
}
cb.replayer.onRollOut = cb.replayer.onPress = function() {
removeTip();
}
cb.replayer.onRelease = function() {
ns.seek(0);
ns.pause(false);
cb.plabel.gotoAndStop(1);
}
var rewInt;
cb.rewinder.onRollOver = function() {
showTip(" Rewind");
}
cb.rewinder.onRollOut = function() {
removeTip();
}
cb.rewinder.onPress = function() {
rewInt = setInterval(rewind,200);
ns.pause(true);
removeTip();
}
cb.rewinder.onRelease = cb.rewinder.onReleaseOutside = function() {
clearInterval(rewInt);
ns.pause(false);
}
function rewind() {
ns.seek(ns.time-18);
if(ns.time == 0) {
clearInterval(rewInt);
ns.pause(false);
}
}
cb.player.onRollOver = function() {
showTip(" Play/Pause");
}
cb.player.onRollOut = cb.player.onPress = function() {
removeTip();
}
cb.player.onRelease = function() {
ns.pause();
cb.plabel.play();
}
cb.stopper.onRollOver = function() {
showTip(" Stop Video");
}
cb.stopper.onRollOut = cb.stopper.onPress = function() {
removeTip();
}
cb.stopper.onRelease = function() {
ns.seek(0);
ns.pause(true);
cb.plabel.gotoAndStop(2);
removeTip();
}
var ffInt;
cb.fforwarder.onRollOver = function() {
showTip(" Fast Forward");
}
cb.fforwarder.onRollOut = function() {
removeTip();
}
cb.fforwarder.onPress = function() {
removeTip();
ffInt = setInterval(ff,200);
}
cb.fforwarder.onRelease = cb.fforwarder.onReleaseOutside = function() {
clearInterval(ffInt);
/*if(ns.time / dur > .95) {
ns.seek(0);
ns.pause(false);
}*/
}
function ff() {
if(ns.time / dur < .95) {
ns.seek(ns.time + 1);
}
else {
clearInterval(ffInt);
}
}
pr.scrubba.onPress = function() {
ns.pause(true);
_root.onEnterFrame = scrubba;
pr.startDrag(false,-258.5,pr._y,-258.5+ld._width-4,pr._y);
}
pr.scrubba.onRelease = pr.scrubba.onReleaseOutside = function() {
_root.onEnterFrame = videoUpdate;
ns.pause(false);
pr.stopDrag();
removeTip();
}
function scrubba() {
var p = (pr._x - pstart) / swidth;
ns.seek(p * dur);
}
//==========================================================
//======================================================
//==============SOUND CONTROL===========================
//======================================================
_root.createEmptyMovieClip("vidsound",_root.getNextHighestDepth());
vidsound.attachAudio(ns);
var sou:Sound = new Sound(vidsound);
sou.setVolume(75);
var startxs = controlBar.vol._x;
controlBar.vol._x = startxs+(70*.75);
controlBar.vol.onPress = function() {
this.startDrag(false,startxs - 2,this._y,startxs+72,this._y);
_root.tooltip._x = Math.round(_root._xmouse);
_root.tooltip._y = Math.round(_root._ymouse);
this.onEnterFrame = voller;
}
controlBar.vol.onRelease = controlBar.vol.onReleaseOutside = function() {
this.stopDrag();
removeTip();
delete this.onEnterFrame;
}
function voller() {
var perc = ((controlBar.vol._x-(startxs-2)) / (74));
sou.setVolume(Math.ceil(perc*100));
_root.tooltip.datext.text = " " + sou.getVolume() + "% Volume";
_root.tooltip._x = Math.round(_root._xmouse);
_root.tooltip._y = Math.round(_root._ymouse);
_root.tooltip._visible = true;
}
//======================================================
//======================================================
//==============TOOL TIPS===============================
//======================================================
infoTip._visible = false;
var ti:Number;
function showTip(datext) {
ti = getTimer();
_root.tooltip.datext.text = datext;
_root.tooltip.onEnterFrame = function() {
var tempti = getTimer();
if(tempti-ti > 500) {
this._x = Math.round(_root._xmouse);
this._y = Math.round(_root._ymouse);
_root.tooltip._visible = true;
}
}
}
function removeTip() {
_root.tooltip._visible = false;
delete _root.tooltip.onEnterFrame;
}
_root.tooltip._visible = false;
any ideas on what the problem is?