1 Replies - 2733 Views - Last Post: 08 August 2017 - 09:51 AM

#1 MarkR   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 08-August 17

Actionscript 3 Control Timeline after Duration of no input from user

Posted 08 August 2017 - 12:47 AM

Hi guys, is there someone who can help me.

I am trying to build an interactive wayfinder, and I need the wayfinder to return back to the home page (frame 1) after a period of inactivity.

In other words, while people are using the wayfinder, it works as normal..But if someone walks away from it, and no one is using the screen, after about 15-20 seconds it will revert back to the home page.

I have received some help, on stackoverflow but it there seems to be errors. The first one is one I have used before, but I cannot remember how to set it up again.

stage.displayState = StageDisplayState.FULL_SCREEN;
         this.timer = new Timer(40000,1);
         this.timer.addEventListener(TimerEvent.TIMER_COMPLETE,this.idle);
         this.timer.start();
         stage.addEventListener(MouseEvent.MOUSE_MOVE,this.resetTimer);



But I know this is missing some elements. Someone else posted this code, but it dosent seem to work.

class test extends MovieClip{
public var myTimer:Numbeer;
public var input:TextField;
function test(){
  myTimer=0;
  this.addEventListener(Event.ENTER_FRAME,timer);
  input.addEventListener(Event.CHANGE, input_from_user);
   }
function timer(ev){

     myTimer +=(1/25);//if the frame rate is 25 frame per sconde
      if(myTimer ==15){
         this.gotoAndStop(1);
         this.removeEventListener(Event.ENTER_FRAME,timer);   
                }
   }
function input_from_user(ev){
    myTimer =0;
 }
}



But that comes up with object. Symbol 'Wayfinder', Layer 'Actions', Frame 4, Line 1 1084: Syntax error: expecting leftbrace before leftparen.

Possibly because the code is contained in a movie..

Any help would be greatly appreciated.

Thankyou

This post has been edited by modi123_1: 08 August 2017 - 06:44 AM
Reason for edit:: fixing botched code tags


Is This A Good Question/Topic? 0
  • +

Replies To: Actionscript 3 Control Timeline after Duration of no input from user

#2 ArtificialSoldier   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2409
  • View blog
  • Posts: 7,367
  • Joined: 15-January 14

Re: Actionscript 3 Control Timeline after Duration of no input from user

Posted 08 August 2017 - 09:51 AM

Does that error message go with that code? Line 1 of the class definition doesn't contain a left parenthesis.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1