Ok it's much clearer now!
Merci Guillaume!

On Mar 11, 2:35 pm, Guillaume Lepicard <[email protected]>
wrote:
> Hi François
>
> You should use
> h.values().invoke("draw");
> As specified in the Has#each method, the iterator's first argument is an
> object with two properties : key and 
> valuehttp://api.prototypejs.org/language/Hash/prototype/each/
>
> On Thu, Mar 10, 2011 at 8:17 PM, Francois <[email protected]>wrote:
>
> > Hi!
> > I had problems using the 'invoke' method with an Hash :
> > the Enumerable API says about 'invoke' : "Invokes the same method,
> > with the same arguments, for all items in a collection. Returns the
> > results of the method calls."
> > so I expected the following code to work :
>
> > function A() {};
> > A.prototype.draw = function()  {
> >        console.log('A.draw');
> > };
> > var h = new Hash({ a: new A});
> > console.log('h.size = ', h.size());
> > h.invoke('draw');
>
> > but the last call to invoke throws an exception.
> > What is wrong with my code? any suggestion ?
> > Thanks in advance!
>
> > ps: I did this to work around the problem :
> > h.each( function(e) { e[1].draw(); } );
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Prototype & script.aculo.us" group.
> > To post to this group, send email to
> > [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> >http://groups.google.com/group/prototype-scriptaculous?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to