【发布时间】:2016-02-05 16:22:04
【问题描述】:
当我将代码行添加到我的显示框补间时,点击事件将不再触发。我的控制台中没有错误。如何解决我的问题?我做错了什么?
createjs.Tween.get(directionsbox, { loop: false }).to({ x:800, y: 650 }, 4000)
完整代码
var directionsbox = new createjs.Container();
displaybox = new createjs.Shape();
displaybox.graphics.beginFill("#D8D8D8").drawRoundRect(0, 0, 800, 570, 2);
displaybox.name = "DirectionsBox";
displaybox.x = -800;
displaybox.y = -650;
var label = new createjs.Text("\Congratulations! \n \nYou have Completed a three levels." + "\n \nYour score: " + totalScoresFromAllLevels + "\n \nYour sccore was submited to the Arcade. \n\n\nPlay again? Click here.", "bold 20px Arial", "#000");
label.textAlign = "left";
label.lineWidth = 540;
label.y = displaybox.y + 5;
label.x = displaybox.x + 10
directionsbox.addChild(displaybox, label);
self.stage.addChild(directionsbox);
createjs.Tween.get(directionsbox, { loop: false }).to({ x:800, y: 650 }, 4000)
var helper = new createjs.ButtonHelper(displaybox, "out", "over", "down", false, displaybox, "hit");
helper.y = displaybox.y;
helper.x = displaybox.x + 275
displaybox.addEventListener("click", handleClick);
function handleClick(event) {
console.log("Clicking it");
createjs.Sound.play("click");
self.stage.removeChild(directionsbox);
visitedUpdateScoreFunction = false;
incrimentLevels();
//initializeGame();
self.stage.removeAllChildren();
gameData.Terms = shuffle(gameData.Terms);
GamehasEnded = true;
addBackground();
initializeGame();
}
【问题讨论】:
标签: javascript jquery html createjs tween