Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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 ?

Explorer ,
Sep 15, 2015 Sep 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 ? If yes then how can we do it ?

TOPICS
ActionScript
930
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 15, 2015 Sep 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

}

Translate
Community Expert ,
Sep 15, 2015 Sep 15, 2015

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 15, 2015 Sep 15, 2015

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2015 Sep 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

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 15, 2015 Sep 15, 2015

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 16, 2015 Sep 16, 2015

The component player has its own listeners built in, I believe.

FLVPlayback - Adobe ActionScript® 3 (AS3 Flash) API Reference

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 16, 2015 Sep 16, 2015
LATEST

Ok Thanks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines