I would suggest creating the delegate once, you could do it in lzx

<attribute name='changeDel'
                       value="$once{ new lz.Delegate( this, 'changeCard' )
}"/>

or in script in an init method

then pass it each time to addTimer

On Mon, Apr 25, 2011 at 9:02 PM, Chris Janik <[email protected]> wrote:

>  Here's the whole code I'm using. I've only ever used timer for small
> things and the documentation on them is week so I'm not really clear on how
> they work. Using your method could I change the code below into a while loop
>
>         <method name="changeCard" args="ignore=null">
>             this.setAttribute('frame', rolonum);
>             if (rolonum == 4) {
>                 rolonum = 1;
>             } else {
>             rolonum= rolonum + 1
>             }
>             this.timer();
>         </method>
>         <method name="timer">
>
>             lz.Timer.addTimer( new LzDelegate(this, "changeCard"), 15000 );
>         </method>
>
> Chris
>
>
> On 11-04-25 08:59 PM, Henry Minsky wrote:
>
> yeah you dont need to keep instantiating new delegates, just keep a pointer
> to the one
> you want and keep passing it to addTimer
>
> On Mon, Apr 25, 2011 at 8:56 PM, Chris Janik <[email protected]>wrote:
>
>>  Sorry. I understand what it does. I don't know what I was thinking.
>>
>> Chris
>>
>>
>> On 11-04-25 08:43 PM, Henry Minsky wrote:
>>
>> what does your code look like?
>>
>> a call like
>> lz.Timer.addTimer( this.stillDownDelegate, 500 );
>> pushes the delegate onto a list at worst, and that entry (not the
>> delegate) will be garbage collected when the timer fires.
>>
>>
>>
>> On Mon, Apr 25, 2011 at 8:25 PM, Chris Janik <[email protected]>wrote:
>>
>>> Hey All,
>>>
>>> What happens when a timer finishes it's count? I want to create a timed
>>> loop but every time it runs I'm creating a new timer. I'm worried that
>>> if this goes on for a while it will really get bloated.
>>>
>>> Any thoughts would be very much appreciated
>>>
>>> --
>>> Chris
>>>
>>>
>>
>>
>> --
>> Henry Minsky
>> Software Architect
>> [email protected]
>>
>>
>>
>
>
> --
> Henry Minsky
> Software Architect
> [email protected]
>
>
>


-- 
Henry Minsky
Software Architect
[email protected]

Reply via email to