Hi terry_hrtn, Can you post the entire code now? I would like to see why it's not working.
Correcting Michael's suggestion: setInterval(mx.utils.Delegate.create(this, upCount), 1000); I just tested your code after resolving scope issues, it works fine for me.... -abdul -----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] Sent: Saturday, April 23, 2005 12:31 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: help with setInterval... Does not work. On 4/12/05, michael keirnan <[EMAIL PROTECTED]> wrote: > > it would be good to go through the Flex UG sections on scoping and event > listeners. in the long run understanding scope is invaluable. in your > test case the following might work: > > setInterval(mx.utils.Delegate.create(this, upCount, 1000); > > </mgk> > > terry_hrtn wrote: > > >Matt...now I'm getting the message below in the debug file...any > >suggestions. > > > >Warning: [type Function] is not a function > > at () > > > >--- In flexcoders@yahoogroups.com, Matt Chotin <[EMAIL PROTECTED]> wrote: > > > > > >>You're having scope issues. setInterval(this, "upCount", 1000); > >> > >> > >> > >>More info here: > >>http://livedocs.macromedia.com/flex/15/flex_docs_en/00001662.htm > >><http://livedocs.macromedia.com/flex/15/flex_docs_en/00001662.htm> > >> > >> > >> > >>Matt > >> > >> > >> > >> _____ > >> > >>From: terry_hrtn [mailto:[EMAIL PROTECTED] > >>Sent: Monday, April 11, 2005 10:03 AM > >>To: flexcoders@yahoogroups.com > >>Subject: [flexcoders] help with setInterval... > >> > >> > >> > >> > >>Needing some help with setInterval... > >>Can someone tell me why "setInterval" calls the "upCount" function > >>but does not update label on screen? > >> > >><?xml version="1.0" encoding="utf-8"?> > >><mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml > >><http://www.macromedia.com/2003/mxml> " > > >> <mx:Script> > >> <![CDATA[ > >> > >> var nCnt : Number = 0; > >> var lClock : Number = -1; > >> > >> function startClock() > >> { > >> btStart.enabled = false; > >> btStop.enabled = true; > >> > >> upCount(); > >> lClock = setInterval(upCount,1000); > >> > >> lbClockStat.text = 'Started! (' + lClock > >>+ ')'; > >> } > >> > >> function upCount() > >> { > >> nCnt += 1; > >> lbShow.text = 'Count: ' + nCnt; > >> } > >> > >> function stopClock() > >> { > >> lbClockStat.text = "Stopped at " + nCnt; > >> nCnt = 0; > >> btStop.enabled = false; > >> btStart.enabled = true; > >> clearInterval(lClock); > >> } > >> > >> > >> ]]> > >> </mx:Script> > >> <mx:Panel width="304" height="121" > > >> <mx:Label id="lbShow" text="start" /> > >> <mx:HBox> > >> <mx:Button id="btStart" label="Start Clock" > >>click="startClock()" /> > >> <mx:Button id="btStop" label="Stop Clock" > >>click="stopClock()" enabled="false" /> > >> </mx:HBox> > >> <mx:Label id="lbClockStat" /> > >> </mx:Panel> > >></mx:Application> > >> > >> > >> > >> > >> > >> > >> _____ > >> > >>Yahoo! Groups Links > >> > >>* To visit your group on the web, go to: > >>http://groups.yahoo.com/group/flexcoders/ > >><http://groups.yahoo.com/group/flexcoders/> > >> > >>* To unsubscribe from this group, send an email to: > >>[EMAIL PROTECTED] > >><mailto:[EMAIL PROTECTED]> > >> > >>* Your use of Yahoo! Groups is subject to the Yahoo! > >><http://docs.yahoo.com/info/terms/> Terms of Service. > >> > >> > > > > > > > > > > > > > >Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > > > > > Yahoo! Groups Links > > > > > Yahoo! Groups Links Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/