Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
}
}
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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');
}
}
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.)
Copy link to clipboard
Copied
yh thts what ive used still not working
Copy link to clipboard
Copied
use the code i suggested.
Copy link to clipboard
Copied
i am using the code you suggested. But it comes up with a problem for the first of the code
Copy link to clipboard
Copied
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');
}
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now