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

how to get a page to return to the main page after a period of inactivity on as2.0 for CS6?

New Here ,
Nov 20, 2015 Nov 20, 2015

Hi

Im doing a school project where we have to make a multiedia product on Flash Pro. I am using the lastest version CS6 and action script 2.0.

I am trying to figure out how to make a page (scene) return to the main page, which for me is a splash page, after a period of inactivity?

Btw, i do not understand a lot of the coding so can you explain it pretty much step by step

Please reply ASAP

TOPICS
ActionScript
944
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 ,
Nov 20, 2015 Nov 20, 2015

var inactivityTime:10000;

var startTime:Number = 0;

this.onMouseMove=function(){

startTime=getTimer();

this.onEnterFrame=inactivityCheckF;

}

function inactivityCheckF(){

if(getTimer()-startTime>inactivityTime){

delete this.onEnterFrame;

// return to main page

}

}

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
New Here ,
Nov 20, 2015 Nov 20, 2015

thanks for that

But it still doesnt work. Okay so if the period of inactivity is 5mins and there is a scene called 'home' and i want it to return to a scene called 'splash', where do i put that information in the script?

sorry this is my first time using flash, so i have no idea on how to do anything except the basics

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 ,
Nov 20, 2015 Nov 20, 2015

label the keyframe in 'splash' (eg, 'frame1_splash') and in frame 1 of your main timeline put:

var inactivityTime:300000;  // you'll probably want to decrease this for testing.

var startTime:Number = 0;

var tl:MovieClip = this;

this.onMouseMove=function(){

startTime=getTimer();

tl.onEnterFrame=inactivityCheckF;

}

function inactivityCheckF(){

if(getTimer()-startTime>inactivityTime){

delete tl.onEnterFrame;

tl.gotoAndStop('frame1_splash');

}

}

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
New Here ,
Nov 23, 2015 Nov 23, 2015

It kind of works, but every time i move the mouse it returns to the 'splash' scene. so the inactivity period is not working.

Also when the scene returns to the 'splash' scene the animation on the page doesnt work

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
New Here ,
Nov 23, 2015 Nov 23, 2015

okay now my animation works, but there's still a problem with the fact that every time i move the mouse it goes bk to the 'splash' scene. I want it so after say 5mins it automatically goes to the 'splash' scene

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 ,
Nov 23, 2015 Nov 23, 2015

make sure you used this:

tl.onEnterFrame=inactivityCheckF;

NOT THIS

tl.onEnterFrame=inactivityCheckF();

in your mousemove listener.

(p.s when using the adobe forums, please mark helpful/correct responses, if there are any.)

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
New Here ,
Nov 25, 2015 Nov 25, 2015

yh thts what ive used still not working

Capture.JPG

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 ,
Nov 25, 2015 Nov 25, 2015

use the code i suggested.

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
New Here ,
Nov 25, 2015 Nov 25, 2015

i am using the code you suggested. But it comes up with a problem for the first of the code

Capture1.JPG

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 ,
Nov 25, 2015 Nov 25, 2015
LATEST

copy and paste this code:

var inactivityTime:Number = 300000; 

var startTime:Number = 0;

var tl:MovieClip = this;

this.onMouseMove=function(){

startTime=getTimer();

tl.onEnterFrame=inactivityCheckF;

}

function inactivityCheckF(){

if(getTimer()-startTime>inactivityTime){

delete tl.onEnterFrame;

tl.gotoAndStop('frame1_splash');

}

}

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