开发者

ActionScript beginner, understanding for-each

开发者 https://www.devze.com 2023-01-12 13:33 出处:网络
Why this: for each (var dieListener:Object in dieListeners) { var f:Function = (dieListener as Function);

Why this:

    for each (var dieListener:Object in dieListeners)
    {
        var f:Function = (dieListener as Function);
        f();
    }

..doesn't wor开发者_JAVA技巧k, if this:

    for (var i:int=0; i<dieListeners.length; i++)
    {
        var f:Function = (dieListeners.getItemAt(i) as Function);
        f();
    }

..works!?

(the first one simply doesn't enter the for loop, but the second do!)


ArrayList doesn't support for each. Try to use an ArrayCollection instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消