Adobe Air: adding a timer through Javascript

So I am working on a small app that should run a fixed javascript routine (a refresh of a page) every 60 seconds.

First off, make sure that you have the AirAliases.js loaded:

<script src="AIRAliases.js" type="text/javascript"></script>

And then run this code through Javascript:

function startTimer(){
   myTimer = new air.Timer(60000, 0);
   myTimer.addEventListener(air.TimerEvent.TIMER, appLoad);
   myTimer.start();
}
The second argument for air.Timer() is the number of times you want this timer to run. I run the code at the end of the "appLoad()" function, so it get's looped automatically.

The addEventListener is an listener that runs when the TIMER is finished, and it runs the "appLoad" function.

Comments

BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.