AS3:SetChildIndex 不起作用
我正在使用 QuickBox2D 库,并且尝试将一个对象移动到舞台底部。
但它不起作用,QuickBox2D 似乎无法识别它。
Call to a possibly undefined method setChildIndex through a reference with static type com.actionsnippet.qbox:QuickBox2D.
对象:
var gameBall:QuickObject;
ChildIndex
sim.setChildIndex(gameBall, 0);
I'm working with the QuickBox2D library, and I'm trying to move one object to the bottom of the stage.
But it's not working, QuickBox2D doesn't seem to recognize it.
Call to a possibly undefined method setChildIndex through a reference with static type com.actionsnippet.qbox:QuickBox2D.
Object:
var gameBall:QuickObject;
ChildIndex
sim.setChildIndex(gameBall, 0);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
QuickBox2D 类继承自 EventDispatcher,而不是 DisplayObjectContainer 其中 setChildIndex 已定义。我没有看到在 QuickBox2D 系统中处理 z 索引的方法,这对我来说实际上是有意义的,因为对象不应该在物理系统中重叠。
The QuickBox2D class inherits from EventDispatcher, not DisplayObjectContainer where setChildIndex is defined. I don't see a way to handle z-indicies in the QuickBox2D system, which actually makes sense to me because objects shouldn't overlap in a physical system.
让我们看一下
setChildIndex()
DisplayObjectContainer
定义的方法。DisplayObject
类型。目前,您正在尝试:
QuickBox2D
实例(而不是DisplayObjectContainer
)调用setChildIndex()
。QuickBox2D
的另一个实例作为第一个参数(需要是DisplayObject
)。Let's have a look at
setChildIndex()
DisplayObjectContainer
.DisplayObject
.Currently, you're trying to:
setChildIndex()
from an instance ofQuickBox2D
(not aDisplayObjectContainer
).QuickBox2D
as the first agument (which needs to be aDisplayObject
).