0 Favourites

how to reload the canvas by external java script?

  • I need to referesh my construct2 canvas by a hyperlink on my html5 document ...i tried the following code

    var c=document.getElementById("c2canvas");
    var ctx=c.getContext("2d");
    ctx.clearRect(0,0,500,580);
    
    [/code:2dj2fo5h]
    
    I thought maybe clearing the rect may call OnlayourStart function but i am getting null object in my ctx...then somewhere on internet i found this code where it was written it can refresh the canvas from the start.
    [code:2dj2fo5h]
    var oldcanv = document.getElementById('c2canvas');
    document.removeChild(c2canvas)
    
    var canv = document.createElement('c2canvas');
    canv.id = 'canvas';
    document.body.appendChild(c2canvas);[/code:2dj2fo5h]
    
    but this also did not work , i just need simple way to re-load my whole construct2 canvas by hyperlink ..so the "On start Layout" would get call one time by its trigger whenever someone clicks the hyperlink.
  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
[PLUGIN] Canvas
627 186,706
zenox98's avatar
zenox98
Unread hot topic
0 Favourites
[Plugin] Three.js 3D canvas
134 12,731
Schoening's avatar
Schoening
Unread hot topic
69 6,666
PrinceofMars's avatar
PrinceofMars