Skip to main content
Inspiring
June 4, 2018
Question

Replay app from frame 1 when not in use

  • June 4, 2018
  • 2 replies
  • 445 views

Hi all again...

I am using this code to try to restart my app for a touch screen in a kiosk,  from frame 1 when nobody touch it for 1 min, but it's not working it starts randomly when I touch in the screen ...

Am I doing something wrong?

Even if I try it in the computer, with the mouse instead of the touch screen, it happens the same...

var myTimer:Timer = new Timer(50000, 1);

myTimer.addEventListener(TimerEvent.TIMER, timerHandler);

myTimer.start();

 

stage.addEventListener(MouseEvent.MOUSE_MOVE, moveMouse);

 

function moveMouse(evt:MouseEvent):void {

    myTimer.reset();

    myTimer.start();

}

 

function timerHandler(evt:TimerEvent):void {

    gotoAndPlay(1);

}

Thank you all

AB

This topic has been closed for replies.

2 replies

ATGBAuthor
Inspiring
June 6, 2018

No solution yet here, any other help or a different code so I can try?

Thank you all

Best

Ana

JoãoCésar17023019
Community Expert
Community Expert
June 4, 2018

Hi.

I run a test with your code here in my PC and everything is fine.

Is this code in frame 1 and is there any other data you can share with us?

Thanks.

ATGBAuthor
Inspiring
June 5, 2018

Hi Thanks for the help,

I am using the code with two different files and gives the same problem in both.

The only thing in common is the full screen code:

stage.displayState=StageDisplayState.FULL_SCREEN;

I have them both on the first frame like this:

stage.displayState=StageDisplayState.FULL_SCREEN;

var myTimer:Timer = new Timer(50000, 1);

myTimer.addEventListener(TimerEvent.TIMER, timerHandler);

myTimer.start();

 

stage.addEventListener(MouseEvent.MOUSE_MOVE, moveMouse);

 

function moveMouse(evt:MouseEvent):void {

    myTimer.reset();

    myTimer.start();

}

 

function timerHandler(evt:TimerEvent):void {

    gotoAndPlay(1);

}

Do you think can be it?

Other than that ...

I am using it in a touch screen,

Using only "gotoandstop"

Oh, just notice I am also using in both:

This.goAndPlay...

Thank again

AB