[Laszlo-dev] delegates *must* have an argument?

Raju Bitter rajubitter at me.com
Thu Mar 19 09:22:00 PDT 2009


Yes, that would be good.
Raju

On Mar 19, 2009, at 5:01 PM, Sarah Allen wrote:

> The reference page for Idle doesn't say what it argument is...
> http://labs.openlaszlo.org/trunk-nightly/docs/reference/lz.IdleService.html
>
> my guess is the reference is rife with those kind of omissions...  
> should I bother to report it?
>
> Sarah
>
> On Mar 19, 2009, at 8:14 AM, Raju Bitter wrote:
>
>> There have a been a few changes with AS3 for function parameters:
>> http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3_Flex/WS5b3ccc516d4fbf351e63e3d118a9b90204-7f56.html
>>
>> It should be in the reference, at least that has been said last year:
>> http://markmail.org/message/ddxot2ycdmxugzmq
>>>
>>> When creating a delegate `new LzDelegate(<object>, <methodname>)`,  
>>> <methodname> must be a method of one argument, because it will be  
>>> invoked by LzDelegate#execute with one argument (typically the  
>>> argument that is passed to LzEvent#sendEvent when that delegate is  
>>> registered to receive events). If <methodname> is called  
>>> elsewhere, it will have to be called with a suitable argument).
>>> (I have added this to the RefGuide entry for LzDelegate)
>>
>> - Raju
>>
>> On Mar 19, 2009, at 3:57 PM, Sebastian Wagner wrote:
>>
>>> same mistery for me but I think its because in AS3 you got to match
>>> the exact number of arguments. Otherwise the Code will be not
>>> compiled.
>>>
>>> sebastian
>>>
>>> 2009/3/19 Sarah Allen <sarah at ultrasaurus.com>:
>>>> So, I've got this code...
>>>>
>>>>  <method name="_activateTimeDel">
>>>>      //Debug.write("mediastream._activeTimeDel()", this);
>>>>      if (!this._timedel) {
>>>>          this._timedel = new LzDelegate(this, "_updateTime");
>>>>      }
>>>>
>>>>      this._timedel.unregisterAll();
>>>>      this._timedel.register(lz.Idle, "onidle");
>>>>  </method>
>>>>
>>>> I had noticed that _updateTime had an unused (and undocumented)  
>>>> argument 'v'
>>>> which I removed to make the code cleaner and clearer.  However,  
>>>> in the swf9
>>>> runtime, I learn that delegates *must* be declared with an  
>>>> argument:
>>>> WARNING: Invalid delegate: mediastream name: ms._updateTime =>  
>>>> Function
>>>> (must accept one argument)
>>>>
>>>> So, I go look up in the reference to see what the argument is and  
>>>> find no
>>>> mention of it.  Is this a doc omission?
>>>>
>>>> just curious... for now, I'll just put back the mysterious 'v'
>>>>
>>>> Sarah
>>>>
>>>
>>>
>>>
>>> -- 
>>> Sebastian Wagner
>>> http://www.webbase-design.de
>>> http://openmeetings.googlecode.com
>>> http://www.laszlo-forum.de
>>> seba.wagner at gmail.com
>>>
>>
>



More information about the Laszlo-dev mailing list