在AS3中设置多个深度层
我知道如何在 as3 中设置深度 - 但使用 as2 我可以使用数字开始多个“深度点” - 在 as3 中我似乎能做的就是将此对象设置为比该对象更高/更低的深度。问题是(在处理一堆等距框时,用户可以将其以任何顺序放置在网格上)我不想处理让每个元素都知道每个其他元素在哪里的额外复杂性,然后适当调整。
我想要做的是设置 6 个总深度数字/位置,每个深度数字/位置对应 6 x 6 网格中的每一列。因此,第 1 列中的任何内容都将从 500 开始其深度放置,第 2 列中的任何内容将从 1000 开始其深度,第 3 列中的任何内容将从 1500 开始,依此类推。
这样,当我将一个对象放在特定的列上时,它会将自己塞在其他列中的所有周围项目下方或上方,这对我来说比以某种方式弄清楚 15 个不同大小的盒子在哪里要容易得多,如何它们彼此相关,然后弄清楚它们需要进入什么深度顺序。
有什么想法吗? as3 似乎已经删除了将深度设置为特定数字的功能:p
I get how to set depth in as3 - but with as2 i could begin multiple 'depth points' using numbers - where in as3 all i can seem to do is set this object to a higher/lower depth than that object. The problem is (when dealing with a stack of isometric boxes, which can be placed by the user on a grid in any order) i don't want to deal with the added complexity of having every element know where every other element is, then adjust appropriately.
What I'm trying to do is set up 6 total depth numbers/positions, one for each column in a 6 x 6 grid. So anything in column 1 will begin it's depth placement at say 500, anything in column 2 will begin its depth at 1000, column 3 would be 1500 and so on.
That way, the second i place an object on a particular column, it would tuck itself under, or place itself above all surrounding items in other columns, this to me is much much easier than somehow figuring out where 15 different sized boxes are, how they relate to one another, then figure out what depth order they need to go in.
Any ideas? as3 seems to have removed the ability to set a depth to a specific number :p
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该方法可以简化。您基本上想要创建 3 个“容器”剪辑并按顺序添加它们。最后添加的一个是最上面的。
奖励:如果您想重新排列,您可以在任何剪辑(甚至已经添加的剪辑)上调用 addChild() ,该剪辑将移至顶部。
The approach can be simplified. You basically want to create 3 'container' clips and add them in order. The last one added is the top-most.
Bonus: if you want to rearrange, you can call addChild() on any clip (even already added ones) and that one will go to the top.