Advertisement
| Hall of Fame |
|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: |
videos();
function videos():Void
{
// All Matts Stuff below here...
//initialise vars
var nDownload:Number;
var nPlayback:Number;
var totalLength:Number;
var currentVideo:Number = 0;
var totalVideos:Number;
var paused:Boolean = false;
var movieEnded:Boolean;
var aVideos:Array = new Array();
//load xml file
var videoXML:XML = new XML();
videoXML.ignoreWhite = true;
var rootNode:XMLNode;
var currNode:XMLNode;
videoXML.onLoad = function():Void
{
rootNode = this.firstChild;
for (var i:Number = 0; i < rootNode.childNodes.length; i++)
{
currNode = rootNode.childNodes[i];
aVideos.push({source:currNode.attributes["tvad_filename"], title:currNode.attributes["tvad_title"],description:currNode.attributes["description"]});
}
totalVideos = aVideos.length;
populateList();
};
videoXML.load("Data/videos.xml");
//lets get the functions out of the way....
var cList:Object = mcTab.mcPlaylist.cList;
cList.vScrollPolicy = "auto";
var listListener:Object = new Object();
cList.addEventListener("change", listListener);
listListener.change = function()
{
var index:Number = cList.selectedIndex;
currentVideo = index;
populateFields(index);
playVideo(aVideos[index].source);
};
function populateList():Void
{
for (var i:Number = 0; i<totalVideos; i++)
{
cList.addItem(aVideos[i].title);
}
cList.selectedIndex = currentVideo;
populateFields(0);
playVideo(aVideos[0].source);
}
//this is where you can access the xml data easily
function populateFields(index:Number):Void
{
_root.tTitle.text = "TV COMMERCIALS " + aVideos[index].title;
}
//stuff to connect to video and set up buffer
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.setBufferTime(5);
mcVideo.oVideo.attachVideo(ns);
function playVideo(video:String):Void
{
movieEnded = false;
mcBuffer._visible = true;
clearIntervals();
ns.play(video);
nDownload = setInterval(downloadProgress, 1000/24);
nPlayback = setInterval(playback, 1000/24);
}
//this bit checks what is happening with the playback
ns.onStatus = function(oInfo:Object):Void
{
trace(oInfo.code);
//check if the movie has started
if (oInfo.code == "NetStream.Play.Start")
{
trace("movie has started");
}
///check if the movie has finished
if (oInfo.code == "NetStream.Play.Stop")
{
//if it has stopped, goto next one.
currentVideo++;
progressbar = true;
playVideo(aVideos[currentVideo].source);
populateFields(currentVideo);
//check to see if we're on the last video
//if we are
if (currentVideo == totalVideos)
{
//original block of code
//add what you wanna do after all the vids have been looped through
_root.attachMovie("introTVCs_mc", "introTVCs_mc", 1, {_x: 0, _y: 0});
//in this block dude :)
trace("movie ended");
clearInterval(nPlayback);
movieEnded = true;
mcBuffer._visible = false;
}
//videos();
}
//and if the source file can't be found?
if (oInfo.code == "NetStream.Play.StreamNotFound")
{
trace("movie cannot be found");
}
if (oInfo.code == "NetStream.Buffer.Full")
{
mcBuffer._visible = false;
}
if (oInfo.code == "NetStream.Buffer.Empty" && !movieEnded)
{
trace("buffer empty");
mcBuffer._visible = true;
// buffer is empty now we need to check if remaining movie time is less buffer requirement
var timeRemaining:Number = totalLength-ns.time;
if (timeRemaining<ns.bufferTime)
{
ns.setBufferTime(timeRemaining);
}
}
};
ns["onMetaData"] = function (oInfo:Object):Void
{
totalLength = oInfo.duration;
};
//just to check how quickly it buffered
trace(ns.bufferTime);
//check how much has loaded and update status bar if needed
var nBytesLoaded:Number;
var nBytesTotal:Number;
var percentageLoaded:Number;
function downloadProgress():Void
{
nBytesLoaded = ns.bytesLoaded;
nBytesTotal = ns.bytesTotal;
percentageLoaded = nBytesLoaded/nBytesTotal*100;
mcProgressBar.mcDownloadBar._xscale = percentageLoaded;
if (percentageLoaded == 100)
{
clearInterval(nDownload);
}
}
//just in case
function clearIntervals():Void
{
clearInterval(nDownload);
clearInterval(nPlayback);
}
}
|