To add to kangax's reply, it is possible to pass in additional
parameters to the bindAsEventListener call and they will be passed
down to your observing function via additional parameters. Keep in
mind though that the first argument will always be the fired event
object. Here is a small example with a few extra ideas to play with:

var Sample = {
  initialize: function(){
    $('some_id').observe('click',
this.clicked.bindAsEventListener(this, 'Hello'));
  },
  clicked: function(event, something){
    // at this point, 'this' will refer to the instance of the Sample object
    event.stop(); // if you want to
    alert(something); // will be "Hello"
    this.somethingElse();
  },
  somethingElse: function(){
    alert('Hey there');
  }
};

-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 rubyonrails-spinoffs@googlegroups.com
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