# Problem with timeout translation from AS2 to AS3

**URL:** <https://forum.kirupa.com/t/problem-with-timeout-translation-from-as2-to-as3/289842>\
**Category:** flash\
**Created:** [June 5, 2009, 2:20pm UTC](https://forum.kirupa.com/t/problem-with-timeout-translation-from-as2-to-as3/289842 "2009-06-05T14:20:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zigsta](https://avatars.discourse-cdn.com/v4/letter/z/ed8c4c/32.png) [@zigsta](https://forum.kirupa.com/u/zigsta)\
**Post date:** [June 5, 2009, 2:20pm UTC](https://forum.kirupa.com/t/problem-with-timeout-translation-from-as2-to-as3/289842/1 "2009-06-05T14:20:26Z")

</div>

Hi guys I’m trying to change this piece of code to AS3 and am having problems with the \_root from AS2. The code changes the position of movie clip if there is no mouse movement for 20 sec’s. any help with translation would be greatly appreciated.

//BACK TO START TIMEOUT  
function idleTime( ) {

// Play the attract animation

//trace(“playing the animation”)

```
var titleTween:Tween = new Tween (bigMc,"x", Strong.easeOut, bigMc.x, 600, 2, true);
var titleTween:Tween = new Tween (bigMc,"y", Strong.easeOut, bigMc.y, 400, 2, true);

```

[//titleTween.onMotionFinished](https://titleTween.onMotionFinished) = function () {  
//menuMC.\_y = 543;  
//newx = 600;  
//newy = 400;

```
    //}

```

}

function idleS( ) {

// See if there has been any mouse movement in the last two seconds

if ((\_root.\_xmouse + \_root.\_ymouse) != mousePos) {

```
// If there has, restart the check for the idle timer

//trace("resetting");

clearInterval(idle);

idle = setInterval(idleTime, 20000);

//} else {

//trace("no movement this period");

```

}

// Store an integer representing the mouse position

mousePos = \_root.\_xmouse + \_root.\_ymouse;

}

function startIdle( ) {

mousePos = -100000; // Initialize it to a dummy value

idleSample = setInterval(idleS, 2000);

}

startIdle( );

stop( );

Thanks In Advance.
