Thanks, Abdul! Actually, only #2 below works. #1 does not work. But the good news is that #2 does and we're happily updating!
Appreciate the suggestion! --- In [email protected], "Abdul Qabiz" <[EMAIL PROTECTED]> wrote: > Hi Rick, > > This is scope issue, handleTimer() function is being called in different > scope and updateData(..) function is not resolved in that scope, hence > not invoked. This problem happens when you pass a function reference to > setInterval(..), this is currently issue with setInterval(..). > > With little change in your code, you can avoid this using any one of > following ways: > > > 1) > > function updateData() { > > trace('updating'); > > TagDataService.send (); > > trace('updated'); > > } > > > > function handleTimer() { > > trace('firing'); > > updateData(); > > trace('fired'); > > } > > > > function enableTimer() { > > setInterval(this, > "handleTimer", 5000 ); > > } > > > > > > > > > > 2) > > > > function updateData() { > > trace('updating'); > > TagDataService.send (); > > trace('updated'); > > } > > > > function handleTimer() { > > trace('firing'); > > updateData(); > > trace('fired'); > > } > > > > function enableTimer() { > > setInterval( > mx.utils.Delegate.create(this, handleTimer), 5000 ); > > } > > > > > > hope that helps... > > > > BTW! This has been discussed earlier, you can search archives to know > more... > > > > -abdul > > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of Rick Bullotta > Sent: Tuesday, June 28, 2005 8:15 AM > To: [email protected] > Subject: [flexcoders] Using setInterval to call an HttpService and > update visual components > > > > Using the following AS, I expected to see the updateData method being > called each 5 seconds. The "firing" and "fired" trace output occurs, > but the updateData method is never called. The enableTimer method is > called upon creation of a DataGrid which is the display object for the > HttpService named TagDataService. If the updateData method is > explicitly called (via a button press), everything works fine. What am > I missing? > > > > function updateData() { > > trace('updating'); > > TagDataService.send (); > > trace('updated'); > > } > > > > function handleTimer() { > > trace('firing'); > > updateData(); > > trace('fired'); > > } > > > > function enableTimer() { > > setInterval( > handleTimer, 5000 ); > > } > > > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.com > > > > ________________________________ > > YAHOO! GROUPS LINKS > > > > * Visit your group "flexcoders > <http://groups.yahoo.com/group/flexcoders> " on the web. > > * To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED] subject=Unsubscribe> > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of > Service <http://docs.yahoo.com/info/terms/> . > > > ________________________________ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 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/

