as2 flv playback - cant make it play randomly
hello,
im working on a project l that needs my immediate attention but i can t seem to make it work, since im not very good with scripting.. What i need to do here, is to make the 3 flvs which play when the lists buttons are pressed, to play randomly and get rid of the playlist. The second part i know how to do, the random play is the problem. Please help thanks in advance
this is the as im using
[I]
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
theVideo.attachVideo(ns);
ns.setBufferTime(10);
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));
}
_root.createEmptyMovieClip("vSound",_root.getNextH ighestDepth());
vSound.attachAudio(ns);
var so:Sound = new Sound(vSound);
so.setVolume(0);
mute.onRollOver = function() {
if(so.getVolume()== 0) {
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.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");
videoList.setStyle("selectionColor",0xFFFF00);
videoList.setStyle("textSelectedColor",0x000000);
videoList.setStyle("rollOverColor",0xCCCCCC);
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width