我想根据舞台宽度限制对象的创建。
我的方法如下:
for (var i:int = 0; i<7; i++){
如果我这样做了,它就不会工作
for (var i:int = 0; i<(stage.width); i++){
我做错了什么?
完整代码:
[SWF(width = 350, height = 600, frameRate = 60)]
import com.actionsnippet.qbox.*;
var sim:QuickBox2D = new QuickBox2D(this);
sim.createStageWalls();
// make a heavy circle
sim.addCircle({x:3, y:3, radius:0.4, density:1});
// create a few platforms
// make 26 dominoes
for (var i:int = 0; i<7; i++){
//End
sim.addCircle({x:1 + i * 1.5, y:18, radius:0.1, density:0});
sim.addCircle({x:2 + i * 1.5, y:17, radius:0.1, density:0});
sim.addCircle({x:1 + i * 1.5, y:16, radius:0.1, density:0});
sim.addCircle({x:2 + i * 1.5, y:15, radius:0.1, density:0});
//Mid end
sim.addCircle({x:0 + i * 2, y:14, radius:0.1, density:0});
sim.addCircle({x:0 + i * 2, y:13, radius:0.1, density:0});
sim.addCircle({x:0 + i * 2, y:12, radius:0.1, density:0});
sim.addCircle({x:0 + i * 2, y:11, radius:0.1, density:0});
sim.addCircle({x:0 + i * 2, y:10, radius:0.1, density:0});
}
sim.start();
sim.mouseDrag();
答案 0 :(得分:1)
你必须使用stage.stageWidth
解释一下: