Skip to main content
nandinidas
Known Participant
September 15, 2015
解決済み

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.
  • 1018 ビュー

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 ?

このトピックへの返信は締め切られました。
解決に役立った回答 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

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
nandinidas作成者
Known Participant
September 15, 2015

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

Joseph Labrecque
Community Expert
Community Expert
September 15, 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

}