I wrote a plugin to lazy load image from URL to prevent broken image in case of slow network..
Everything are fine in r95. But in r114 my javascript code is broken..??
Following this code:
///
var c=document.getElementById("c2canvas");
var ctx=c.getContext("2d");
/////
And the answer is ctx == null or undefined
This is bug...???
My code segment here
<font color=RED>
// draw myImage
instanceProto.paint = function (myparam)
{
//alert("here: "+ this.runtime.id);
//alert(this.x);
var _x = this.x;
var _y = this.y;
var _w = this.width;
var _h = this.height;
//this.runtime.trigger(pluginProto.cnds.ImageLoaded,instance);
var image = new Image();
image.src = myparam;
var c=document.getElementById("c2canvas");
//var c = $("#c2canvas")[0>;
var ctx=c.getContext("2d");
if(c.getContext("2d")!=null){
image.onload= function(){
ctx.drawImage(image, _x - _w/2, _y- _h/2, _w,_h);
}
//this.draw(con);
//this.runtime.redraw=true;
this.image = image;
}else{
alert("what the heck...??");
}
};
//////////////////////////////////////
So how do I solve this problem in case the runtime was changed...???
Thank in advanced