0

AS3 compiler does not accept object-definition, like this:

private var iconList:Object {
            1: {
                leftUp: 10,
                rightBottom: 40,
                downScale: 0.5
            },
            2: {
                leftUp: 50,
                rightBottom: 80,
                downScale: 0.5
            },
            3: {
                leftUp: 90,
                rightBottom: 120,
                downScale: 0.5
            }

        }

How can I make a multidimensional Object()?

I am making a CSS-sprite reader in AS3, and I need to iterate through the image that I load with Loader(). For this, I would like to set up the iteration datas in an Object.

4

1 回答 1

2

Actually AS3 does support this, you have forgotten an equation sign.

private var iconList:Object = { // here
        1: {
            leftUp: 10,
            rightBottom: 40,
            downScale: 0.5
        },
        2: {
            leftUp: 50,
            rightBottom: 80,
            downScale: 0.5
        },
        3: {
            leftUp: 90,
            rightBottom: 120,
            downScale: 0.5
        }

    }
于 2013-03-30T10:21:11.780 回答