Skip to main content
nandinidas
Known Participant
September 15, 2015
Answered

Is it possible to play or pause a video by clicking on the video itself than using the control bar's play and stop buttons ?

  • September 15, 2015
  • 1 reply
  • 1017 views

Is it possible to play or pause a video by clicking on the video itself than using the control bar's play and stop buttons ? If yes then how can we do it ?

This topic has been closed for replies.
Correct answer Joseph Labrecque

When you define the video object, simply add an event listener like:

myVideo.addEventListener(MouseEvent.CLICK, toggleVideoPlayback);

private function toggleVideoPlayback(e:MouseEvent):void {

//if playing, pause

//if paused, play

}

1 reply

Joseph Labrecque
Community Expert
Community Expert
September 15, 2015

Just add an event listener to the video display object itself. Are you building your own playback or using something prepackaged?

nandinidas
Known Participant
September 15, 2015

Building own playback with movieclips and buttons. Can you please help me with the code ?

nandinidas
Known Participant
September 16, 2015

When you define the video object, simply add an event listener like:

myVideo.addEventListener(MouseEvent.CLICK, toggleVideoPlayback);

private function toggleVideoPlayback(e:MouseEvent):void {

//if playing, pause

//if paused, play

}


Thanks...In case I had used the pre packaged flv player would I had to write the same code ?