[Laszlo-user] Laszlo function as Array.sort argument

Pablo Kang pkang at laszlosystems.com
Wed Jan 9 12:35:48 PST 2008


Awesome. Thanks everyone!



On Wed, 9 Jan 2008, André Bargull wrote:

> As a workaround to access "Debug.write", you can use:
> _root.Debug.write("%s: %d - %d", arguments.callee, n1, n2);
>
>> I think the call to Debug.write is killing it.
>> 
>> 
>> 
>> On Jan 9, 2008 2:28 PM, Pablo Kang <pkang at laszlosystems.com wrote:
>>
>>
>>>  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
>>>> 
>>>> 
>>>> 
>>>>
>>>> 
>>> 
>>>
>>> 
>> 
>> 
>> 
>> -- Henry Minsky Software Architect hminsky at laszlosystems.com
>
> -- 
>


More information about the Laszlo-user mailing list