title: Tips on passing "this" reference to a method in javascript
body: <p>So for my code below, I'm trying to pass the "this" keyword of the outer function into the draw_bldText(...) function. But how do can i do this? When I call this inside the execute, "this" refers inside the function scope. I want the "this" keyword from this.piece.</p>
  
  <p>I hope my question makes sense, I'm new to javascript</p>
  
  <pre><code>this.myDrawFunction;
  this.piece = this;
  switch(image) {
      case "blank":
          break;
      case "bldText":
      myDrawFunction = {
          execute : function() {
              draw_bldText(this, this_popup.context, this_popup.focus);       
          }
          };
      . . .
      . . .
      default:
          break;
  }
  </code></pre>