# Time Problem

**URL:** <https://forum.kirupa.com/t/time-problem/265976>\
**Category:** random\
**Created:** [July 15, 2008, 5:40am UTC](https://forum.kirupa.com/t/time-problem/265976 "2008-07-15T05:40:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![satya\_17784](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@satya\_17784](https://forum.kirupa.com/u/satya_17784)\
**Post date:** [July 15, 2008, 5:40am UTC](https://forum.kirupa.com/t/time-problem/265976/1 "2008-07-15T05:40:56Z")

</div>

Hi,  
I am working on a small project. It’s a Rollover , Rollout project. There is an image1 on roll over of that image1 another image2 appears. The image2 should hold 6 second’s on rollout of mouse from image1.And if within 6 sec we again rollover on image1 then the image 2 should hold its position else after 6 sec if there is no rollover on image1 within 6 sec then image2 should go to its original position.  
The code is -----------------  
btn\_01.onRelease = function(){  
getURL(“[http://www.yahoo.co.in](http://www.yahoo.co.in)”,\_blank);  
}  
btn\_01.onRollOver = function(){  
Flag1 = 0;  
Timer1 = 0;  
//trace(Flag1);  
gotoAndStop(“main”);  
}  
btn\_01.onRollOut = function(){  
Flag1 = 1;  
Timer1 = 0;  
//trace(Flag1);  
checkCounter();  
}  
function checkCounter(){  
trace(Timer1);  
if(Flag1==1)  
{  
if(Timer1 \< 6)  
{

Timer1 = Timer1+1;  
//checkCounter();  
var my\_timedProcess:Number = setTimeout(checkCounter, 1000, true);

}  
else  
{  
Flag1 = 0;  
trace(“Flag”+Flag1)  
Timer1 = 0;  
trace(“Timer1”+Timer1)  
gotoAndPlay(“out1”);  
break;  
}  
}  
else  
{  
Flag1 = 0;  
trace(“Flag----”+Flag1)  
Timer1 = 0;  
trace(“Timer1----”+Timer1)  
break;  
}  
}

thanks and Regards

Satyendra …

please help me…

---

<div class="post-metadata">

**Author:** ![Volgogradetz](https://avatars.discourse-cdn.com/v4/letter/v/77aa72/32.png) [@Volgogradetz](https://forum.kirupa.com/u/Volgogradetz)\
**Post date:** [July 15, 2008, 6:05am UTC](https://forum.kirupa.com/t/time-problem/265976/2 "2008-07-15T06:05:51Z")

</div>

Somthing like that. I didn’t test, but should work.

```auto
var my_timedProcess:Number;
mage1._visible = false;
 
image1.onRollOver = function(){
   image2._visible = true;
   clearTimeout(my_timedProcess);
   my_timedProcess = setTimeout(this, imgDisappear, 6000);
}
 
function imgDisappear():Void{
   image2._visible = false;
}

```
