开发者

ActionScript beginner, understanding for-each

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜