Er, sorry change your ShortTimer function to look like this
private function ShortTimer():void
{
// creates a new five-second Timer
if(minuteTimer==null) {
minuteTimer = new Timer(1000);
Seth
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Seth Caldwell
Sent: Thursday, December 20, 2007 12:54 PM
To: [email protected]
Subject: RE: [flexcoders] Re: IE keeps growing and growing and growing
Yes, it does.
I don't understand why you are creating a timer for 5 seconds and then
starting it again. Why not just create a timer forever?
Just do this,
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private var minuteTimer:Timer = null;
private function nav(myUrl:String):void
{
var urlToNav:URLRequest = new URLRequest(myUrl);
navigateToURL(urlToNav,"_blank");
}
[Bindable]
private var num:int = 1;
////move the visible section of the data grid in focus
private function changeIndex():void
{
entries.scrollToIndex(num);//entries refers to the data
grid below
if (num < RSSfeed.lastResult.rss.channel.item.length){
num++;//increase if thess than the length of
the feed
}else{
num = 1;//set back to 1
}
}
private function ShortTimer():void
{
// creates a new five-second Timer
if(minuteTimer==null) {
var minuteTimer:Timer = new Timer(1000);
// designates listeners for the interval event and the
completion event
minuteTimer.addEventListener(TimerEvent.TIMER, onTick);
minuteTimer.addEventListener(TimerEvent.TIMER_COMPLETE,
onTimerComplete);
}
// starts the timer ticking
minuteTimer.start();
}
private function onTick(evt:TimerEvent):void
{
if(evt.target.currentCount%5==0){
changeIndex();
}
}
public function onTimerComplete(evt:TimerEvent):void
{
minuteTimer=null;
}
]]>
</mx:Script>
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of doepositive
Sent: Thursday, December 20, 2007 12:30 PM
To: [email protected]
Subject: [flexcoders] Re: IE keeps growing and growing and growing
I think it may have to do with calling addEventListener. I think it
may be adding and adding and adding. Is there a way to create a timer
that calls a function every time an interval is reached? I've
experimented with using useWeakReference but I don't see a
difference. Any help would be appreciated.
--- In [email protected] <mailto:flexcoders%40yahoogroups.com> ,
"doepositive" <[EMAIL PROTECTED]>
wrote:
>
> I'm changing the selectedIndex of a data grid with a simple
function
> call triggered by a Timer. I posted something a few weeks ago about
> the same topic when changing an image. I was under the impression
> that it was the image that was makeing the IE object size grow but
it
> seems with this new test that there is another issue with
automating
> a function with a Timer. Does anybody have any work arounnd for
this
> problem? I can't belive that this type of thing is an issue with a
> platform like flex.
>
> Here is the working code...it's pretty straight forward. I just
don't
> get it.
>
> ---------------------------CODE-------------------------------------
--
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> layout="vertical"
> width="577"
> height="68"
> horizontalAlign="center" paddingBottom="0" paddingLeft="0"
> paddingRight="0" paddingTop="0"
> verticalAlign="middle" initialize="RSSfeed.send()"
> creationComplete="ShortTimer()">
>
> <mx:Script>
> <![CDATA[
> import mx.controls.Alert;
> private function nav(myUrl:String):void
> {
> var urlToNav:URLRequest = new URLRequest(myUrl);
> navigateToURL(urlToNav,"_blank");
> }
> [Bindable]
> private var num:int = 1;
> ////move the visible section of the data grid in focus
> private function changeIndex():void
> {
> entries.scrollToIndex(num);//entries refers to the data
> grid below
> if (num < RSSfeed.lastResult.rss.channel.item.length){
> num++;//increase if thess than the length of
> the feed
> }else{
> num = 1;//set back to 1
> }
> }
> private function ShortTimer():void
> {
> // creates a new five-second Timer
> var minuteTimer:Timer = new Timer(1000, 5);
> // designates listeners for the interval event and the
> completion event
> minuteTimer.addEventListener(TimerEvent.TIMER, onTick);
> minuteTimer.addEventListener(TimerEvent.TIMER_COMPLETE,
> onTimerComplete);
>
> // starts the timer ticking
> minuteTimer.start();
> }
> private function onTick(evt:TimerEvent):void
> {
> if(evt.target.currentCount == 5){
> ShortTimer();
> }
> }
> public function onTimerComplete(evt:TimerEvent):void
> {
> changeIndex()
> ShortTimer();
> }
>
>
> ]]>
> </mx:Script>
> <mx:Style>
> DataGrid {
> backgroundAlpha: 1;
> backgroundColor: #000000;
> alternatingItemColors: #ffffff, #eff1f2;
> horizontalGridLines: true;
> letterSpacing: 0;
> horizontalGridLineColor: #990000;
> verticalGridLines: false;
> useRollOver: false;
> borderThickness: 2;
> borderColor: #ffffff;
> selectionColor: #000000;
> color: #ff0000;
> textSelectedColor: #ff0000;
> textIndent: 0;
> dropShadowEnabled: true;
> shadowDistance: 3;
> shadowDirection: right;
> fontSize: 14;
> fontWeight: normal;
> headerStyleName: "mydataGridHeaderStyle";
> }
>
> .mydataGridHeaderStyle {
> color: #999999;
> letterSpacing: 0;
> }
> </mx:Style>
> <mx:HTTPService showBusyCursor="true" id="RSSfeed"
> url="http://www.weather.gov/alerts/ma.rss" resultFormat="object" />
> <mx:DataGrid sortableColumns="false" width="506" height="48"
> id="entries" dataProvider="{RSSfeed.lastResult.rss.channel.item}"
> horizontalCenter="0" verticalCenter="0"
> click="nav(RSSfeed.lastResult.rss.channel.item
> [entries.selectedIndex].link)" cornerRadius="6" borderStyle="solid"
> borderColor="#00ff00" alternatingItemColors="[#000000, #000000]"
> selectedIndex="1">
> <mx:columns>
> <mx:DataGridColumn dataField="title"
> headerText="Mass Weather Advisory Feed" fontSize="9"
> wordWrap="true"/>
> </mx:columns>
> </mx:DataGrid>
> </mx:Application>
>