title: Maintain this pointer in javascript using prototype
body: <p>Im having an issue with using prototypes <code>observe</code> function and gaining access to this pointer. Consider the following:</p>
  
  <pre><code>var Demo = Class.create({
      this.someValue = "this is the value",
  
      initialize: function() {
          Event.observe("button1", "click", function() {
              alert(this.someValue);
          });
  
          Event.observe("button2", "click", this.testFunc());
      },
  
      testFunc: function() {
          alert(this.someValue);
      }
  });
  </code></pre>
  
  <p>Clicking on both the <code>button1</code> and <code>button2</code> controls do not perform what I would like which is to have the alert display "this is the value" but instead it displays the source of the event (ie, the button). So my question is how i can achieve what i am after and have the this pointer be equal to the <code>Demo</code> class.</p>