我已经看到可以相对于另一个对象添加对象但我无法让它工作的代码。我只是想画一个矩形,然后添加另一个相对于第一个更小的矩形
public var rectangle:Sprite = new Sprite();
public var other:Sprite = new Sprite();
rectangle.graphics.beginFill(0xFF0000);
rectangle.graphics.drawRect(250, 10, 100, 100);
rectangle.graphics.endFill();
other.graphics.beginFill(0x00FF00);
other.graphics.drawRect(0, 0, 50, 50);
other.graphics.endFill();
rectangle.addChild(other);
this.addChild(rectangle);
两个矩形最终都相对于舞台进行渲染。我在这里做错了什么?