Skip to content

The click event is not working properly #630

@ghost

Description

I added a click event on an object, It is working fine when I tap on my mouse pad but clicks doesn't seem to work. It sometimes takes 2-3 clicks for it to work.

This is my code.
There's a video playing and the canvas is on top of it.

var o1 = new createjs.Shape();
o1.graphics.setStrokeStyle( 0 ).beginStroke( '#000' ).drawRect(81,117,234,41);
o1.alpha = 0;
var o1Hit = new createjs.Shape();
o1Hit.graphics.beginFill("#000").drawRect(81,117,234,41);
o1.hitArea = o1Hit;
options.addChild(o1);
options.update();

o1.on("click", function(evt) {
    videojs('sortedd', {}, function(){
    this.src({ type: "video/mp4", src: 'questions/question_1/Q394.mp4' });
    this.play();
    currentQuestion = 1;
    options.removeAllChildren();
    options.update();
    var audioElement = document.createElement('audio');
    audioElement.setAttribute('src', 'audio.mp3');
    audioElement.setAttribute('autoplay', 'autoplay');
    audioElement.load();
    audioElement.addEventListener("load", function() {
    audioElement.play();
    }, true);
   });
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions