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