
Welcome Guest
|
#1
|
|||
|
|||
|
combining setTimeout and setInterval
Hello folks,
im trying to run this class that first calls setInterval, then upon reaching an inner threshold, clear the interval and start a timer with setTimeout. when the time's up, call another function that will start an interval of its own. The final bit doesnt work - i reach the other function, but it doesnt call the interval method. the code: Code:
private function run()
{
_root.mytrace("in run, this._visible = " + this._visible);
_root.mytrace(txtField.htmlText);
_root.mytrace("container._x = "+container._x + " container._y = "+ container._y + " txtField._y = "+ txtField._y + " txtField._width = " +txtField._width);
slide();
slideIntervalId = setInterval(this, "slide", slideTime);
//container._y = 0;
}
private function slide()
{
_root.mytrace("in slide, y= " +container._y);
if (container._y <= 5)
{
container._y += 2;
}
else
{
container._y =5;
clearInterval(slideIntervalId);
//start timer to slide out
_global.setTimeout(exitAnnouncement, TIME_TO_DISPLAY);
_root.mytrace("out of slide");
//exitAnnouncement();
}
}
private function exitAnnouncement()
{
_root.mytrace("in exitAn");
_parent.slideOut();
_root.mytrace("in exitAn2");
slideOut();
_root.mytrace("in exitAn3");
slideOutIntervalId = setInterval(this, "slideOut", slideTime);
}
function slideOut()
{
_root.mytrace("in slideOut, y= " +container._y);
if (container._y <= pHeight)
{
container._y += 2;
}
else
{
container._y =pHeight;
clearInterval(slideOutIntervalId);
}
}thanks fo your help, YoS. |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|

Programming Languages


