Re: setInterval and Behaviors

by "Cyanide _7" <leo7278(at)hotmail.com>

 Date:  Sun, 02 Jul 2000 03:21:48 CDT
 To:  diades(at)diades.screaming.net
 Cc:  hwg-languages(at)hwg.org
  todo: View Thread, Original
ok, heres a dumb question, but why are you using setInterval and not 
setTimeout? your interval immediately calls a function that clears itself. 
in either case, the scope of the "down" variable is local to the "LowerMenu" 
function and is undefined in the "lower" function, so its my guess that 
thats whats crashing it. - Cyanide

>
>Your script is calling lower so often you can't see it, the function takes 
>a
>value in 1/1000 of a second. try 2000 and see if it works like you want.
>
>Data Driven Design
>P.O. Box 1084
>Holly Hill, FL 32125-1084
>Phone : (904) - 226-8979
>URL : http://www.datadrivendesign.com
>URL : http://www.rossidesigns.net
>----- Original Message -----
>From: "Keith Parker" <diades(at)diades.screaming.net>
>To: "hwg Languages" <hwg-languages(at)hwg.org>
>Sent: Saturday, July 01, 2000 5:36 PM
>Subject: setInterval and Behaviors
>
>
> > Hi,
> >
> > I am currently writing a behavior and wish to use setInterval but it 
>keeps
> > causing the script to stop working.  Can setInterval be used within a
> > behavior and, if so, how?
> >
> > I have the following:
> >
> > <PUBLIC:METHOD NAME="LowerMenu" />
> > <script>
> > function LowerMenu(){
> > style.display = "block"
> > down = setInterval("lower()",2)
> > }
> >
> > function lower(){
> > style.pixelTop = offsetTop += 30
> > if(offsetTop >= 400){
> > style.pixelTop = 400
> > clearInterval(down)
> > }
> > }
> > </script>
> >
> > When LowerMenu() is called externally from another behavior routine, it
> > freezes.
> >
> > Hope you can help.
> >
> > Cheers,
> >
> > Keith
> >
> >
>

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA