Thank-you so much, I had tried the bindAsEventListener before and just
got different errors.
I did not catch that I needed to bind the iterator.

Works great now.



On Jan 30, 3:08 pm, "Justin Perkins" <[EMAIL PROTECTED]> wrote:
> On Jan 30, 2008 1:46 PM, wte <[EMAIL PROTECTED]> wrote:
>
> > What am I not understanding?
>
> In anonymous functions like that (you're iterator), you need to bind
> to the current instance of your object. So this:
>
> >         initialize : function() {
> >                 $$("span").each(function(item, index) {
> >                         Event.observe(item, 'mousedown', this.onmousedown, 
> > false);
> >                 });
>
> Would become:
>
> >         initialize : function() {
> >                 $$("span").each(function(item, index) {
> >                         Event.observe(item, 'mousedown', 
> > this.onmousedown.bindAsEventListener(this), false);
> >                 }.bind(this));
>
> -justin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to