Apache – Flex: Timer + HTTPService

apache-flex

I have an application in which when i click on a particular tab an HTTPService having id="service" is sent. This service calls a php file which in turn extracts data from a table and return as xml string to Flex. Flex then use DataGrid's dataprovider attribute to show the data in the dataGrid.

Can i have a functionality of a timer which will call the HTTPService again and again after each 5 minutes?

Best Answer

var timer:Timer = new Timer(5 * 60 * 1000); //time in milliseconds
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
function onTimer(e:TimerEvent):void
{
  service.send();
}
Related Topic