LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 




 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-23-2007, 03:50 PM
YoS YoS is offline
Registered User
 
Join Date: Jun 2007
Posts: 53
Rep Power: 6
YoS is on a distinguished road
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);
        }
    }
_root.mytrace is my equivalent of trace. it works from within exitAnnouncement, but nothing else is called. the attempt with _parent.slideOut() was a shot in the dark out of frustration, it doesnt work either.

thanks fo your help,
YoS.
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump




All times are GMT. The time now is 05:57 PM.