Skip to main content
Inspiring
December 14, 2011
Question

pay/pause during video play

  • December 14, 2011
  • 1 reply
  • 978 views

i wrote this code for video play/pause through SPACE key

play/pause is fine. But not visible play_button when i press SPACE key.

how to write that ?

stage.addEventListener(KeyboardEvent.KEY_DOWN, pausePress);

function pausePress(e:KeyboardEvent):void{

if (e.keyCode == 32){

          ns.togglePause();

          }

}

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
December 14, 2011

:

stage.addEventListener(KeyboardEvent.KEY_DOWN, pausePress);

function pausePress(e:KeyboardEvent):void{
if (e.keyCode == 32){
          ns.togglePause();
play_button.visible=true;  // you'll probably want to toggle this
           } }
Inspiring
December 14, 2011

i want like this not that.

if i press SPACE key video pause Play_btn visible = true;

if i press again SPACE key video playing Play_btn visible = false;

How to ?