ActionScript 3的阵列中的可能设定一个对象的多个变量?多个、阵列、变量、对象

2023-09-08 14:22:43 作者:象牙之森

现在,我有许多影片剪辑在我的阵列。我想更新我的数组中的影片剪辑的所有字母值。

Right now, I have many MovieClips's in my array. I want to update all the alpha values of the MovieClips in my array.

现在,我使用的是循环但这不是这样做的最快方式。

Right now, I am using a for loop but this is not the fastest way to do it.

有没有办法在我的阵列设置中的所有项目的值?

Is there a way to set values for all the items in my array?

谢谢!

推荐答案

没有。 动作没有任何结构,使您可以用code单行改变数组中的所有元素的属性。有一个 Array.forEach( ) 的方法,但我认为这将是比简单的慢为(i = 0; I< LEN;我++)循环,因为这里调用函数的阵列的每个项的开销

No. ActionScript doesn't have any constructs that allow you to change properties of all elements of the array with a single line of code. There is an Array.forEach() method, but I think that would be slower than a simple for(i = 0; i < len; i++) loop as there is an overhead of calling a function for each item of the array.