【问题标题】:ActionScript Measuring 3D DepthActionScript 测量 3D 深度
【发布时间】:2010-06-06 17:51:21
【问题描述】:

我很难理解如何控制 3D 空间中显示对象的 z 属性。我知道深度是如何工作的,但我不明白如何获得最大深度,或者显示对象刚刚消失在背景中的数字。

我假设深度是基于舞台的宽度和高度,这就是为什么分配相同显示对象的相同深度与不同的舞台大小不匹配。

那么我怎样才能适当地测量深度呢?

【问题讨论】:

    标签: actionscript-3 3d depth


    【解决方案1】:

    您需要考虑 childIndex 属性。 actionscript 中没有 Z-index。

    要获得您可以使用的深度:

    // returns the number of direct display children in stage
    stage.numChildren; 
    
    // returns the number of direct display children in you object
    myObj.numChildren; 
    

    设置子 Z-index 使用

    //sets the newIndex of child in stage
    stage.setChildIndex(child:DisplayObject, newIndex:int):void; 
    

    如果 newIndex 为 0,则子元素是顶部可见元素。

    newIndex 必须在 [0, numChildren-1] 否则 flash 会抛出错误

    保重。

    【讨论】:

    • 你误解了我的问题。我说的是 3D 空间中显示对象的 z 属性,而不是显示列表索引。我已经编辑了我的问题以引用 3D。
    • 这句话说得通。你的问题超出了范围。在这种情况下,有一个 Z 索引,您应该检查 adobe 文档以获取 3d。它在那里很好地描述了你需要做什么
    • 不是。文档根本没有提到我正在搜索的信息。
    【解决方案2】:

    从 Flash 10 开始,有一个“z”属性。

    查看此链接以获取教程: http://www.kirupa.com/developer/as3/intro_3d_as3_pg1.htm

    【讨论】:

      【解决方案3】:

      这里有解释:Perspective in Flash

      【讨论】:

        猜你喜欢
        • 2011-08-13
        • 2020-10-19
        • 2019-06-30
        • 1970-01-01
        • 1970-01-01
        • 2018-06-23
        • 1970-01-01
        • 1970-01-01
        • 2012-01-09
        相关资源
        最近更新 更多