Can someone help me modify this script so I can do 1 of 2 things…either have a scrub bar or a rewind and fastforward button. I’m having trouble figuring this out. Ideally the scrub bar would be something that goes ontop of play_mc which is the progrss bar.
// setup
nc = new NetConnection();
nc.connect(null);
ns = new NetStream(nc);
// show netstream messages
ns.onStatus = function(d)
{
trace(d.code);
}
// get the length
ns.onMetaData = function(d)
{
this.duration = d.duration;
}
// attach a video object
myVideo.attachVideo(ns);
// create a movieclip for sound control
this.createEmptyMovieClip("sound_mc",1);
// attach a sound object to the mc to control volume
videoSound = new Sound(sound_mc);
// attact the audio from the netstream to the mc
sound_mc.attachAudio(ns);
// play
ns.play("cornell.flv");
// monitor
function monitorVideo()
{
var loadpct = ns.bytesLoaded / ns.bytesTotal * 100;
var playpct = ns.time / ns.duration * 100;
if(isNaN(loadpct)) loadpct = 0;
if(isNaN(playpct)) playpct = 0;
play_mc._xscale = playpct;
load_mc._xscale = loadpct;
}
// monitor every frame
onEnterFrame = monitorVideo;
// set up button actions
play_btn.onRelease = function()
{
ns.pause(false);
}
pause_btn.onRelease = function()
{
ns.pause(true);
}
rewind_btn.onRelease = function()
{
ns.seek(0);
}
volup_btn.onRelease = function()
{
var vol = videoSound.getVolume();
if(vol < 100)
{
videoSound.setVolume(vol + 20);
}
}
voldown_btn.onRelease = function()
{
var vol = videoSound.getVolume();
if(vol > 0)
{
videoSound.setVolume(vol - 20);
}
}