60 * 30 * 1000
60 seconds
times
30 minutes
times
1000
miliseconds
equals
1800000
I recommend using "60 * 30 * 1000"
instead of the "1800000" so it's easier for you to change/debug
and
then just add an event listener on "timer" event name along with the function
you want it to call upon 30 minutes and then your done :p
On 05/08/06, David
Brown <[EMAIL PROTECTED]com> wrote:
Hello all,
I could use some help. I have been livedocs.macromedia.com/flex/2docs
looking for a way to create a timer function that would execute a function
every 30 min. I found an example of mytimer and looked at a example
for simple analog clock. But I am having a hard time understanding how
it relates to my code. Below is a code snipet.
I would like to run the InitApp() function
every 30 min. That should refresh my two datagrids that inturn will
update my screen.
Any help would be great.
Thank
David
mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" width="500" height="56"
backgroundGradientColors="[#ffffff, #ffffff]"
creationComplete="initVars()" horizontalAlign="center"
verticalAlign="middle" borderColor="#ff0000" backgroundColor="#ffffff"
borderStyle="solid" borderThickness="1">
<mx:Script>
<![CDATA[
import
mx.logging.LogEvent;
/* import
flash.events.MouseEvent;
import
mx.events.FlexEvent; */
import
mx.styles.CSSStyleDeclaration;
import mx.effects.*;
import
mx.events.*;
import
mx.rpc.events.*;
import mx.controls.Alert;
import
mx.managers.PopUpManager;
import
flash.events.Event;
import
flash.events.TimerEvent;
import
flash.utils.Timer;
import
mx.controls.Alert;
import
mx.collections.*;
import
flash.net.*;
import flash.display.Sprite;
[Bindable]
public var
mylocID:String;
// Assign values
to new properties.
private function initVars():void
{
InitApp();
}
public function
InitApp():void
{
//
assign values passed from the html object
flashvars
mylocID =
Application.application.parameters.mylocID;
//
if no value passed from the html object tag then assign
value
if (mylocID == null)
{
mylocID =
"29223";
}
// get
weather
weatherSvc.qryCurrentWeather(mylocID);
weatherSvc.qryExtendedWeather(mylocID);
//
set focus on the first row of the
grids
dgCurrentWeather.selectedIndex =
0;
dgExtendedWeather.selectedIndex =
0;
}
]]>
</mx:Script>
<mx:RemoteObject id="weatherSvc" destination="ColdFusion"
source="Widgets.cfc.widgets" showBusyCursor="true" />