Draw Canvas problem with javascript (plugin)

Get help using Construct 2

Post » Sun Jan 13, 2013 4:55 pm

I really surprised...

My plugin is worked very well in build r95..
Problem comes after I attempt to update to r114.
Javascript library don't recognize the context of element...???

My code as bellow:

     instanceProto.paint = function (myparam)
      //alert("here: "+ this.runtime.id);      
      var _x = this.x;
      var _y = this.y;
      var _w = this.width;
      var _h = this.height;
        var image = new Image();
        image.src = myparam;               
        image.onload= function(){
            var c=document.getElementById("c2canvas");
            var con=c.getContext('2d');
            if(null == con){
               alert("con is null");
            con.drawImage(image, _x - _w/2, _y- _h/2, _w,_h);
        this.image = image;

In test bed, alert message always topup "con is null"...this problem never appeared in old build
Some one please help me...how to solve this problem

Thank in advance
Posts: 73
Reputation: 1,438

Return to How do I....?

Who is online

Users browsing this forum: erickson400, Yahoo [Bot] and 1 guest