Skip to main content
Participating Frequently
June 24, 2014
Answered

Need a stop and replay button for video web banner

  • June 24, 2014
  • 1 reply
  • 739 views

I'm creating my first web banners using full motion video (flv). Needs to be under 40kb per the site's requirements.

I was finally able to get my file size down by avoiding the FLVplayer and using ActionScript (not at all my area of expertise).

I've managed to get the basic video working and playing but I need to add a stop button and a replay button (or return to the initial static image with the play button) at the end of the video.

Here's the code I've managed to piece together thanks to Google.

inv_btn.addEventListener(MouseEvent.CLICK,onReleaseMyButton);

function onReleaseMyButton(event:MouseEvent=null):void {

var myVideo:Video = new Video(300, 170); // note size for video

addChild(myVideo);

var nc:NetConnection = new NetConnection();

nc.connect(null);

var ns:NetStream = new NetStream(nc);

ns.client = new Object();

myVideo.attachNetStream(ns);

ns.play("http://www.dcccd.edu/images/DCCCDlogos/flash/welding.flv");

}

This topic has been closed for replies.
Correct answer kglad

use:

// to stop your video

ns.pause();

// to unpause your video

ns.resume();

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
June 24, 2014

use:

// to stop your video

ns.pause();

// to unpause your video

ns.resume();

Participating Frequently
June 24, 2014

Thanks. That gets me started in the right direction.

Now the question is how do I get the buttons to appear above the video? Or is that even an option?

kglad
Community Expert
Community Expert
June 24, 2014

sure.

use addChild for your buttons AFTER your addChild(myVideo)

p.s. please mark helpful/correct responses