【发布时间】:2013-06-07 21:06:49
【问题描述】:
我正在尝试编写一个简单的游戏,但我被困在这里。我想通过每次有人点击时将它们添加到窗口来显示我的“项目符号”。但是这不起作用,因为我收到一条错误消息,说 bulletsArray(i) 不是属性,所以它不起作用。有什么建议么?想法?谢谢
bulletsArray = new Array();
window.addEventListener("click", spawnBullets);
function spawnBullets(){
bulletsArray.push(Ti.UI.createView({
backgroundColor: "white",
width: 10,
height: 10,
left: shipGun.left,
top: 600
})
);
for(var i = 0; i < bulletsArray; i++){
gameWindow.add(bulletsArray(i));
}
};
【问题讨论】:
-
bulletsArray[i]不是bulletsArray(i)
标签: javascript arrays window titanium titanium-mobile