我試圖使用元素的數組中的一個函數來只讀屬性「tweenjs_count」,我得到這個錯誤CreateJS錯誤:無法分配qContainer
Uncaught TypeError: Cannot assign to read only property 'tweenjs_count' of qContainer.
function handleKeyDown(e)
{
if (!e) {
var e = window.event;
}
if (e.keyCode=='1'.charCodeAt(0)) {
var imagearray = ["qContainer", "milkContainer"];
imagearray.forEach(function(element) {
jumpElemets(element);
});
jumpElemets(imagearray);
}
}
function jumpElemets(element) {
createjs.Tween.get(element, {loop: false})
.to({alpha: 0 ,y: element.y +10}, 200, createjs.Ease.getPowInOut(2))
.to({alpha: 1, y: element.y -10}, 200, createjs.Ease.getPowInOut(2))
.to({alpha: 0,y: element.y }, 100, createjs.Ease.getPowInOut(2))
.to({alpha: 1}, 100, createjs.Ease.getPowInOut(2));
}
你爲什麼要叫'jumpElemets()'每個元素,並那麼整個陣列呢? – jmar777