虽然闪存技术正在消亡,但我仍然必须完成我的项目:)))
如何在 AS3 中为每个循环实现数组中元素的索引,就像 jquery each() 函数一样
jQuery.each( collection, callback(indexInArray, valueOfElement) )
我用这个
for each(var myObj:* in myArray)
{
// do some stuff with myObj
}
如何为每个使用 myArray.splice(index, 1) 这样的状态???
或者根本不可能吗?
最佳答案
这行得通。
var arr:Array = new Array();
arr[1] = true;
arr[5] = true;
arr.forEach(function (item:*, index:int, array:Array)
{
if(item != undefined)
{
callback(index, item);
}
});
关于javascript - AS3 中的 jquery each() 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16208949/