-
[RESOLVED] loop array
The code below works great except I need it to loop.
I've been trying now for two days to get this code to loop I read about
Loops numerous times and I still can,t get it to work.
can any one help please to get this to loop
Code:
stop();
//second
var videos:Array = new Array("first.flv", "second.flv", "third.flv");
var currentVideo:Number = 0;
var duration:Number = 0;
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
my_video.attachVideo(ns);
ns.play(videos[currentVideo]);
//----------------
this.createTextField("loaded_txt", this.getNextHighestDepth(), 40, 180, 160, 22);
loaded_txt.textColor = 255,255,255;
var loaded_interval:Number = setInterval(checkBytesLoaded, 500, ns);
function checkBytesLoaded(my_ns:NetStream) {
var pctLoaded:Number = Math.round(my_ns.bytesLoaded / my_ns.bytesTotal * 100);
loaded_txt.text = Math.round(my_ns.bytesLoaded / 1000) + " of " + Math.round(my_ns.bytesTotal / 1000) + " KB loaded (" + pctLoaded + "%)";
progressBar_mc.bar_mc._xscale = pctLoaded;
if (pctLoaded >= 100) {
clearInterval(loaded_interval);
loaded_txt.removeTextField();
}
}
//-----------------
ns.onMetaData = function(evt:Object):Void {
duration = evt.duration;
};
ns.onStatus = function(evt:Object):Void {
if (this.time > 0 && this.time >= (duration - 0.5)) {
currentVideo++;
if (currentVideo < videos.length) {
ns.play(videos[currentVideo]);
} else {
delete this.onStatus;
}
}
}
Happy New Years everone
p.s. Yes I'm an addict, I love Flash so much I'm coding on New Years day:lovers:
-
No worries, you are not the only one coding on Nears Day. And Happy NEw Year to you too.
I failed to understand if you are using AS 3.0 or 2.0; and did you try putting the stop() at the end of your code?
-
thank you. I'm glad to see theres others like me who love flash as much as I do. sorry about not being imformative, I'm using cs3 using 2.0.
and yes I tried changing the stop(); among otherthings.
I just cant get it.