Skip to main content
Participant
December 15, 2016
Answered

Is there a way to have a SWF autoplay, but still allow for manual user input?

  • December 15, 2016
  • 2 replies
  • 233 views

I am building an interactive display which contains several full screen videos and animations. But that challenge I have is it needs to autoplay when unattended, but also allow a user to stop and explore the display at will and navigate to any part of the overall display. Is it possible to have both autoplay and manual user input co-exisist in the same SWF?

This topic has been closed for replies.
Correct answer kglad

sure.

you can use a timer (that's reset whenever user input is detected) that triggers autoplay. eg,

var autoT:Timer=new Timer(10000,0);  // autoplay after 10 seconds

autoT.addEventListener(TimerEvent.TIMER,autoF);

auto.start();

function autoF(e:TimerEvent):void{

// do whatever to restart

}

// reset whenever the mouse moves

stage.addEventListener(MouseEvent.MOUSE_MOVE,resetF);

// reset whenever video is playing and anything else that you'll want to use to prevent resetting

function resetF(e:Event=null):void{

autoT.reset();

autoT.start();

}

2 replies

Participant
December 15, 2016

Thanks, I'll give that a try, but that sounds like it sorts my issue out.

kglad
Community Expert
Community Expert
December 15, 2016

you're welcome.  but be careful with those videos.  you don't want users to be watching a video and after 10 seconds everything resets.  ie, while videos are playing reset the timer.

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
December 15, 2016

sure.

you can use a timer (that's reset whenever user input is detected) that triggers autoplay. eg,

var autoT:Timer=new Timer(10000,0);  // autoplay after 10 seconds

autoT.addEventListener(TimerEvent.TIMER,autoF);

auto.start();

function autoF(e:TimerEvent):void{

// do whatever to restart

}

// reset whenever the mouse moves

stage.addEventListener(MouseEvent.MOUSE_MOVE,resetF);

// reset whenever video is playing and anything else that you'll want to use to prevent resetting

function resetF(e:Event=null):void{

autoT.reset();

autoT.start();

}