PDA

View Full Version : debug warning for mouse tracking


stuckhere90
12-23-2008, 09:14 PM
I get the following warning when debugging

WARNING: Invalid delegate: «lz.view_$MouseTrackingTest$2Elzx_3_66 function(0)#0| trackmouse» (must accept one argument to handle {regNext: true, onidle: LzEvent, _events: LzEvent, removeCOI: Delegate for [object Object] calls [type Function] 6, coi: Delegate for [object Object] calls [type Function] 3, ...}.onidle)
mousex,mousey = 53 204
mousex,mousey = 53 204
mousex,mousey = 53 204
mousex,mousey = 53 204
mousex,mousey = 53 200


The code I am using to track the mouse is an example straight from open laszlo documentation:
Chapter 31. Input Devices and Gestures
3. Tracking the Mouse
3.1. Tracking the mouse within a single view


The code is provided below, and looks fine to me:

<canvas height="500" width="500" debug="true">
<debug y="300"/>
<view width="300" height="300" bgcolor="red" clickable="true">
<attribute name="moustracker_del" value="$once{ new LzDelegate( this, 'trackmouse' )}"/>
<handler name="onmousedown">
moustracker_del.register(LzIdle,'onidle');
</handler>

<handler name="onmouseup">
moustracker_del.unregisterAll();
</handler>

<method name="trackmouse">
Debug.write("mousex,mousey =", this.getMouse('x'),this.getMouse('y'));
</method>
</view>
</canvas>




Does anyone how to get rid of the warning...it is annoying more than anything.

Thanks!

senshi
12-24-2008, 03:10 AM
Every method which is called through a LzDelegate must accept one argument, this a new restriction due to the support for the swf9 runtime. So, the method signature must look like:


<method name="trackmouse" args="ignore">
Debug.write("mousex,mousey =", this.getMouse('x'),this.getMouse('y'));
</method>

senshi
12-24-2008, 03:13 AM
The argument's name was just called "ignore" as a convenience name, you can actually call it whatever you like.

stuckhere90
12-24-2008, 09:00 AM
thanks for the help!!!

Works great!!!