title: Access class attribute in event handler in js-mootools
body: <p>I have a JS object (working with mootools) wich has stored some DOM elements and attach to them event listeners:</p>
  
  <pre><code>window.myObject = {
      init: function(el1ID, el2ID){
          this.myElement1 = document.getElement(el1ID); 
          this.myElement2 = document.getElement(el2ID);
  
          this.myElement1.addEvents({
              'click' : function(){
                   myObject.myElement2.innerHTML("foo");
               }
          });
      }
  
  }
  </code></pre>
  
  <p>Now, this works only if i had only one object <code>myObject</code> in the page. I have to create another object for another structure <code>el1ID</code>-<code>el2ID</code> and I would like to make this object a class and instantiate an object for every structure, in order to keep every event handling independent from the others. My problem is: how can I access in the event handler the attributes of the <code>myObject</code> object?</p>
  
  <pre><code>'click' : function(){
      myElement2.innerHTML("foo")
   }
  </code></pre>
  
  <p>won't work and</p>
  
  <pre><code>'click' : function(){
      this.myElement2.innerHTML("foo")
   }
  </code></pre>
  
  <p>would search for <code>myElement2</code> as a property of <code>myElement1</code> (aka the event raiser). What can I do in stead of accessing staticly the properties of my object?</p>