This tutorial will assume that you have already created your custom video buttons, and allocated them the name of
- pauseBtn
- playBtn
- stopBtn
now to allow the buttons to actualy do something with the current FLV video, we need to link the buttons to some actionscript code in order to do this you must first open up the actions frame dialogue (press F9) and write the following basic lines of code for basic functionality:
//first we must create the Event Handlers pauseBtn.addEventListener(MouseEvent.CLICK, pauseHandler); playBtn.addEventListener(MouseEvent.CLICK, playHandler); stopBtn.addEventListener(MouseEvent.CLICK, stopHandler); //Changing cursor to hand, so that the user knows that the button can be pushed pauseBtn.buttonMode = true; pauseBtn.useHandCursor = true; playBtn.buttonMode = true; playBtn.useHandCursor = true; stopBtn.buttonMode = true; stopBtn.useHandCursor = true; //End Changing cursor to hand //finaly calling the fucntions for each handler event function pauseHandler(e:MouseEvent):void{ vid.pause(); } function playHandler(e:MouseEvent):void{ vid.play(); } function stopHandler(e:MouseEvent):void{ vid.pause(); //pauses video vid.seek(0); //resets it to frame 1 }
and that its, very simple and easy – if you need help in understanding how to add custom buttons and converting them to movieclips, then please leave a comment!