Content of canvas flashes, some kind of loop

I don't know much of javascript and HTML5 Canvas, I have been creating simple games with Animate CC.

I tried load a image on canvas, and works. But the image just flashes and disapear. (when I refresh the page for example)

Code:

self = this;
self.stop();

loadingImage();
function loadingImage() {
    var myCanvas = document.getElementById('canvas');
    var ctx = myCanvas.getContext('2d');

    var myImage = new Image(1024, 768);

    myImage.onload = function () {
        ctx.clearRect(0, 0, 1024, 768);
        ctx.drawImage(myImage, 0, 0, 1024, 768);
        console.log(myCanvas);
        console.log(myImage);
    }
    myImage.src = 'images/Koala.jpg';
}

The same thing occurs when I try make a input text field, it flashes as if the timeline is looping, but is not. (you can see flash when click)

Code:

self=this;
self.stop();

var input = new CanvasInput({
  canvas: document.getElementById('canvas'),
    x:100,
    y:100,
    width: 500,
    fontWeight:'bold',
});

I think Animate CC generate a loop automatic, but in my project is disabled. You can check the .js.

Image: http://www.dfrikki.com.br/test/

Text Field: http://www.dfrikki.com.br/test2/

Someone can help me to solve this?