title: javascript custom object and image onload
body: <p>i am having trouble with image loading and triggering with safari/mobile safari. i have a custom object that draws on a canvas but needs to wait until an object image property has loaded because it uses the dimensions of the image when drawing. the below code works fine on ff but fails in safari:</p>
  
  <pre><code>function canvasSlider(){
      this.slideImg=new Image();
      this.slideImg.src="images/back_button.png";
      this.somevalue=55;
  }
  canvasSlider.prototype.init = function (){
      alert(this.slideImg.complete + ', ' + this.slideImg.height+', ' + this.somevalue);
  }
  var myObj = new canvasSlider();
  myObj.init();
  </code></pre>
  
  <p>in safari this will always return false for this.slideImg.complete</p>
  
  <p>How can i use this.slideImg.onload=somefunction(); and always ensure the canvasSlider object is passed?</p>
  
  <pre><code>function canvasSlider(){
  this.slideImg=new Image();
  this.slideImg.onload=somefunction(this);
  this.slideImg.src="images/back_button.png";
  this.somevalue=55;
  }
  function somefunction(obj){
  alert(obj.slideImg.complete+', '+obj.slideImg.src);
  }
  var myObj = new canvasSlider()
  </code></pre>
  
  <p>this doesn't work. any ideas?
  Thanks</p>