# Redirect in flash action script

**URL:** <https://forum.kirupa.com/t/redirect-in-flash-action-script/45133>\
**Category:** Uncategorized\
**Created:** [March 11, 2004, 8:50am UTC](https://forum.kirupa.com/t/redirect-in-flash-action-script/45133 "2004-03-11T08:50:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![clemchooi](https://avatars.discourse-cdn.com/v4/letter/c/e274bd/32.png) [@clemchooi](https://forum.kirupa.com/u/clemchooi)\
**Post date:** [March 11, 2004, 8:50am UTC](https://forum.kirupa.com/t/redirect-in-flash-action-script/45133/1 "2004-03-11T08:50:58Z")

</div>

Dear Kirupa members,

Can anyone teach me how to do a timer to redirect the page in browser by using flash action script? Your reply will be kindly appreciate.

Best Regards,  
Clement

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 13, 2004, 8:42am UTC](https://forum.kirupa.com/t/redirect-in-flash-action-script/45133/2 "2004-03-13T08:42:13Z")

</div>

im actually developing a kiosk program. when the user stop moving the mouse on the screen for 30 second. the current page will automatically back to main page. Im using flash mx. i already using getTimer() function. The problem is that how im i going to detect the mouse movement. if the mouse move the timer will start to count again until the user not doing anything or idle for 30 second. please helps

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 13, 2004, 8:46am UTC](https://forum.kirupa.com/t/redirect-in-flash-action-script/45133/3 "2004-03-13T08:46:34Z")

</div>

u can set AS with an event handler  
on(mousemove){  
get timer()  
}  
this should give u the time elapsed since the last mouse move  
and hence u can set if ==30 sec(ur time limit){  
(perform action)  
}  
i think this should be of some help to you.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 15, 2004, 2:23am UTC](https://forum.kirupa.com/t/redirect-in-flash-action-script/45133/4 "2004-03-15T02:23:38Z")

</div>

i have tried the code but i cant make it work. on (mouseMove) event handler need to be in button. Can u send me a working FLA? thank you.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 15, 2004, 2:33am UTC](https://forum.kirupa.com/t/redirect-in-flash-action-script/45133/5 "2004-03-15T02:33:11Z")

</div>

```auto
seconds = 30;//how many seconds of inactivity
function screenSaver() {
//actions to be performed if the idle
//time is equal to the value of seconds
}
this.onEnterFrame = function() {
	elapsedTime = Math.floor(getTimer()/1000-initial);
	if(elapsedTime == seconds){
screenSaver();
}
};
this.onMouseMove = function() {
	initial = getTimer()/1000;
};

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 15, 2004, 3:08am UTC](https://forum.kirupa.com/t/redirect-in-flash-action-script/45133/6 "2004-03-15T03:08:07Z")

</div>

Thanks claudio & tulika. Its helps a lot. Thank You.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 15, 2004, 3:08am UTC](https://forum.kirupa.com/t/redirect-in-flash-action-script/45133/7 "2004-03-15T03:08:59Z")

</div>

Anytime 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 15, 2004, 5:25am UTC](https://forum.kirupa.com/t/redirect-in-flash-action-script/45133/8 "2004-03-15T05:25:21Z")

</div>

It’s ok Clement. Thanks to claudio.
