www.webdeveloper.com
Results 1 to 4 of 4

Thread: [RESOLVED] SetInterval Problem

  1. #1
    Join Date
    Feb 2012
    Posts
    5

    resolved [RESOLVED] SetInterval Problem

    Hello everyone,

    I am working on a project. I need to use SetInterval so a function will execute over and over until i clear the interval. The problem i am having is that after the interval is cleared, I can't set it again. I am getting a error that the object doesn't support that property or method.

    It works fine when I first start it, but the problem is restarting it. I am wondering if there is something i have to do to the variable once after i clear the interval.

    Here is my code.

    function AutoPlay(){
    AutoPlay = setInterval(function(){ShowSlide(2)},6000);
    }

    function StopAuto(){
    clearInterval(AutoPlay);
    }

    Please help me out.I think i need to set the AutoPlay Variable to nul or something like that.

    Thanks,

  2. #2
    Join Date
    Mar 2007
    Location
    U.K.
    Posts
    1,127
    Use the error console and try to interpret why it's telling you something that doesn't seem possible.
    Where used, return should be executed unconditionally and always as the last statement in the function.

    That's my signature, it's not part of the damn post!

  3. #3
    Join Date
    Nov 2010
    Posts
    1,036
    is Autoplay the name of your interval or the name of your function? I think if you chose two different names you would solve this problem quickly.

  4. #4
    Join Date
    Feb 2012
    Posts
    5
    Thanks Xelawho, the problem was the name of the function and the variable.
    Last edited by xScooterx; 10-16-2012 at 02:57 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles