There's a bug open for this, http://openlaszlo.org/jira/browse/LPP-8092

I would recommend putting the code in your .js file into a real class, and
not using the
script block if possible. The bug is  as you saw that declaring

function foo () {
...
}

Does the wrong thing inside of a script block when "when=immediate" is set.

It does work if you declare the function as bound to a global var, i.e.,

var myglobal = function (a, b) {
    return a+b;
}

So that would be a kind of workaround.

Or else you could declare the script block as not "immediate".


On Thu, Feb 4, 2010 at 3:29 PM, cem sonmez <[email protected]> wrote:

> Actually the code that i m trying almost same with you wrote
>
> <canvas debug="true">
>
>     <script src="md5.js" when="immediate" />
>     <button>Md5
>
>         <handler name="onclick">
>             var hash = hex_hmac_md5("bar","foo");
>             Debug.debug("md5 : %w", hash);
>         </handler>
>     </button>
> </canvas>
>
> This works on swf8 runtime.
> But on swf10 runtime i get the following compilation error :
>
> Error: Call to a possibly undefined method hex_hmac_md5, in line: var
> hash_$1 = hex_hmac_md5("bar", "foo");
>
> I always try to work on swf10 runtime. Have ever faced this kind problem on
> swf10?
> Thanks
>
> 2010/2/4 P T Withington <[email protected]>
>
> Can you show your method code?
>>
>> You should be able to say:
>>
>> <script src="md5.js" when="immediate" />
>> <button>
>>  <handler name="onclick">
>>     var hash =  hex_hmac_md5("bar", "foo");
>>    Debug.debug("md5 :", hash);
>>   </handler>
>>  Click me!
>> </button>
>>
>>
>> On 2010-02-04, at 10:42, cem sonmez wrote:
>>
>> > hi all
>> > i can use the "md5.js" javascript file in the lzx such like :
>> >
>> > <script src="md5.js" when="immediate" />
>> >    <script>
>> >        var hash =  hex_hmac_md5("bar", "foo");
>> >        Debug.debug("md5 :", hash);
>> >    </script>
>> >
>> > But i want call this function when any button is clicked.
>> > When i use the lines in the method tag, getting compiler error about
>> canT
>> > find the related function.
>> > Can anyone help me about this issue ?
>> >
>> > King regards
>> > --
>> > Cem SONMEZ
>>
>>
>
>
> --
> Cem SONMEZ
>



-- 
Henry Minsky
Software Architect
[email protected]

Reply via email to