Btw, I know that I can call a laszloMethod from a Javascript function like:

  <method name="javascriptFunction" args="n1,n2">
      return canvas.laszloMethod(n1,n2);
  </method>

What I want to know is why it is I can't pass in the the laszloMethod directly.

Thanks,
pablo

On Wed, 9 Jan 2008, Pablo Kang wrote:

Anyone know why passing in a function defined with an LZX method tag into Array.sort doesn't work? Here's a test case:

<canvas debug="true">

   <method name="laszloMethod" args="n1,n2">
       Debug.write('laszloMethod(', n1, ',', n2, ')');
       return 0;
   </method>

   <script>
       function javascriptFunction(n1,n2) {
           Debug.write('javascriptFunction(', n1, ',', n2 ,')');
           return 0;
       }
   </script>

   <handler name="oninit">
       var arr = [ 1,2,3 ];

       Debug.write('-- Javascript Function --');
       arr.sort( javascriptFunction );

       Debug.write('-- Laszlo Method --------');
       arr.sort( canvas.laszloMethod );
   </handler>

</canvas>

pablo



Reply via email to