I give up! LOL I can’t get this stinkin video to add a replay button at the end of the video below is my AS3… What am I doing wrong. I’ve got a button called: replay on the stage. I want it to show up at the end of the video?
Here’s the video player I’m using: http://theflashblog.com/?p=605
Thanks in advance!
// Video setup -----------------------------------------------/
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, onStatus);
ns.client = this;
video.attachNetStream(ns);
function onStatus(e:Object):void
{
if(e.info.code == "NetStream.Play.Start" ||
e.info.code == "NetStream.Buffer.Full") empty.visible = false;
else if(e.info.code == "NetStream.Buffer.Empty") empty.visible = true;
else if(e.info.code == "NetStream.Play.Stop") ns.seek(0);
}
// Get duration ---------------------------------------------/
var dur:Number;
function onMetaData(meta:Object)
{
dur = meta.duration;
}
// Play the video -------------------------------------------/
ns.play("http://artpilotstudio.com/clients/iamloveapparel/themes/billfrist/flash/Haiti_final.flv");
// Progress bar ---------------------------------------------/
addEventListener(Event.ENTER_FRAME, loop);
thebar.progress.scaleX = 0;
function loop(e:Event):void
{
thebar.loaded.scaleX = ns.bytesLoaded / ns.bytesTotal;
if(dur)
{
thebar.progress.scaleX = ns.time / dur;
}
if(tc.visible)
{
tc.code.text = getTimecode((thebar.track.mouseX/thebar.track.width) * dur);
tc.x = mouseX;
}
}
thebar.loaded.addEventListener(MouseEvent.CLICK, seekTo);
thebar.loaded.addEventListener(MouseEvent.ROLL_OVER, seekOver);
thebar.loaded.addEventListener(MouseEvent.ROLL_OUT, seekOut);
thebar.loaded.buttonMode = true;
thebar.progress.mouseEnabled = false;
function seekTo(e:Event):void
{
ns.seek((thebar.track.mouseX/thebar.track.width) * dur);
}
function seekOver(e:Event):void
{
tc.visible = true;
}
function seekOut(e:Event):void
{
tc.visible = false;
}
// Rewind control ---------------------------------------------/
rewind.addEventListener(MouseEvent.CLICK, rewindClick);
function rewindClick(e:MouseEvent):void
{
ns.seek(0);
}
// play/pause control ---------------------------------------------/
playPause.buttonMode = true;
playPause.addEventListener(MouseEvent.CLICK, playPauseClick);
playPause.addEventListener(MouseEvent.ROLL_OVER, playPauseOver);
playPause.addEventListener(MouseEvent.ROLL_OUT, playPauseOut);
function playPauseClick(e:MouseEvent):void
{
var c:MovieClip = playPause;
if(c.currentFrame == 10)
{
c.gotoAndStop(30);
ns.pause();
}
else if(c.currentFrame == 30)
{
c.gotoAndStop(10);
ns.resume();
}
}
function playPauseOver(e:MouseEvent):void
{
var c:MovieClip = playPause;
if(c.currentFrame == 1)
{
c.gotoAndStop(10);
}
else if(c.currentFrame == 20)
{
c.gotoAndStop(30);
}
}
function playPauseOut(e:MouseEvent):void
{
var c:MovieClip = playPause;
if(c.currentFrame == 10)
{
c.gotoAndStop(1);
}
else if(c.currentFrame == 30)
{
c.gotoAndStop(20);
}
}
// volume control ---------------------------------------------/
mute.buttonMode = true;
mute.addEventListener(MouseEvent.CLICK, muteClick);
mute.addEventListener(MouseEvent.ROLL_OVER, muteOver);
mute.addEventListener(MouseEvent.ROLL_OUT, muteOut);
function muteClick(e:MouseEvent):void
{
var c:MovieClip = mute;
if(c.currentFrame == 10)
{
c.gotoAndStop(30);
ns.soundTransform = new SoundTransform(0);
}
else if(c.currentFrame == 30)
{
c.gotoAndStop(10);
ns.soundTransform = new SoundTransform(1);
}
}
function muteOver(e:MouseEvent):void
{
var c:MovieClip = mute;
if(c.currentFrame == 1)
{
c.gotoAndStop(10);
}
else if(c.currentFrame == 20)
{
c.gotoAndStop(30);
}
}
function muteOut(e:MouseEvent):void
{
var c:MovieClip = mute;
if(c.currentFrame == 10)
{
c.gotoAndStop(1);
}
else if(c.currentFrame == 30)
{
c.gotoAndStop(20);
}
}
// timecode ---------------------------------------------/
tc.visible = false;
function getTimecode(num:Number):String
{
var t:Number = Math.round(num);
var min:Number = Math.floor(t/60);
var sec:Number = t%60;
var tc:String = new String("");
if(min < 10)
{
tc += "0";
}
if(min >= 1)
{
tc += min.toString();
}
else
{
tc += "0";
}
tc += ":";
if(sec < 10)
{
tc += "0";
tc += sec.toString();
}
else
{
tc += sec.toString();
}
return tc;
}