Hi all,
i made a simple FLV Player from a scrap, its go well…
i has a nice seekbar and i took a screenshot of it:
the first button for Rewind = rewindButton, the second button for Play = playButton and Pause = pauseButton and the last button for Sound mute = Disable (did not work in it yet).
the seek bar contains of 4 objects: object number 1 = playdbar, object number 2 = scrub, object number 3 = loadbar and object number 4 = stroke
And this is the code:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
theVideo.attachVideo(ns);
ns.play("http://www.mediacollege.com/video-gallery/testclips/20051210-w50s.flv");
rewindButton.onRelease = function() {
ns.seek(0);
}
playButton.onRelease = function() {
ns.pause();
}
var videoInterval = setInterval(videoStatus, 1000);
var amountLoaded:Number;
var duration:Number;
ns["onMetaData"] = function(obj) {
duration = obj.duration;
}
function videoStatus() {
amountLoaded = ns.bytesLoaded/ns.bytesTotal;
loader.loadbar._width = amountLoaded*242;
loader.scrub._x = ns.time/duration*242;
}
var scrubInterval;
function scruber() {
ns.seek(Math.floor(loader.scrub._x/240)*duration);
}
loader.scrub.onPress = function() {
clearInterval(videoInterval);
scrubInterval = setInterval(scruber, 10);
this.startDrag(false, 0, this._y, 239, this._y);
}
loader.scrub.onRelease = loader.scrub.onReleaseOutside = function () {
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus, 1000);
this.stopDrag();
}
It work well, but…
i want help about seekbar
you can playback and play forward movie by moving the the scrub button only…
i want playback and play forward by moving the scrub button and on click on the loadbar button too and i want the width of playdbar to be as it in the above picture! :*(
I tried it many times but i failed… any one can edit the code please??!
With Thanx