I think I see the pilot error.  The init method of a node is  
automatically called.  By saying oninit="init()" you are calling the  
init method twice, actually making and registering twice as many  
delegates as you think.

On 2006-05-24, at 17:19 EDT, Philip Romanik wrote:

> Hi,
>
> Hopefully this isn't pilot error, but I'm seeing different behavior  
> with event processing depending upon how the event is registered.  
> I'm attaching an example which counts the number of times the  
> onstart, onstop, and onrepeat events are run from an LzAnimator  
> object. If the event handler is created using,
>
>         <method event="onstart">
>           n_onstart++;
>         </method>
>
> everything is fine. But if I create the event using,
>
>        <method name="init">
>          this.del_onstart = new LzDelegate(this, "event_onstart");
>             this.del_onstart.register(a1, "onstart");
>          ...
>        </method>
>
>        <method name="event_onstart">
>          n_onstart++;
>        </method>
>
> all the events appear to be called too many times.
>
>                      onstart  onstop  onrepeat
> <method event="...">    2        1        1
> <method name="...">     4        2        2
> Expected:               1        1        1
>
> The docs explain that onstart is called multiple times, so this  
> explains why it is called more than expected. However, I would  
> expect the counts to be identical for onstop and onrepeat. I ran  
> each test with its own <view> and <animator> object.
>
> Phil
>
>
>
> <events_example.lzx>

_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to