Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 将movieclip的深度设置为数组中的数字_Actionscript 3 - Fatal编程技术网

Actionscript 3 将movieclip的深度设置为数组中的数字

Actionscript 3 将movieclip的深度设置为数组中的数字,actionscript-3,Actionscript 3,我在舞台上有几部电影,所有的电影都排成一排 与应该是什么深度。我需要一种方法来设定深度 数组中的数字 样品 a$=[{name:“item_name_1”,深度:10},{name:“item_name_2”,深度:11},{name:“item_name_3”,深度:12},{name:“item_name_4”,深度:13},{name:“item_name_5”,深度:14}] 我需要像这样的东西: 设置深度(目标名称、深度) 我知道我可以与其他电影剪辑交换深度,但这会导致某些剪辑的深度错

我在舞台上有几部电影,所有的电影都排成一排 与应该是什么深度。我需要一种方法来设定深度 数组中的数字

样品 a$=[{name:“item_name_1”,深度:10},{name:“item_name_2”,深度:11},{name:“item_name_3”,深度:12},{name:“item_name_4”,深度:13},{name:“item_name_5”,深度:14}]

我需要像这样的东西: 设置深度(目标名称、深度)

我知道我可以与其他电影剪辑交换深度,但这会导致某些剪辑的深度错误

谢谢

myArray.sortOn(“depth”,Array.NUMERIC);
//假设深度数意味着它更高,否则以相反的方式迭代
for(var i:int=0;i
这没关系。调用addChild()时,如果它存在,它会将其删除,并将其作为下一项放回顶部。这段代码有效,我以前使用过;-)
   myArray.sortOn("depth", Array.NUMERIC);


    //assuming depth number means it is higher otherwise iterate in reverse
    for (var i:int = 0; i < myArray.length;i++)
    {
      addChild(myArray[i]);
    }