2
有什麼方法可以在Flex應用程序中使用ActionScript實現字典。例如,我想存儲這樣的東西。Flex/ActionScript中的字典
public var orientation:ArrayCollection = new ArrayCollection([
{a: new Direction('0','0','b','0')},
{b: new Direction('a','c','0','h')},
{c: new Direction('0','b','d','e')},
{d: new Direction('c','0','0','0')},
{e: new Direction('f','g','0','c')},
{f: new Direction('0','0','e','0')},
{g: new Direction('0','0','0','e')},
{h: new Direction('0','b','0','i')},
{i: new Direction('l','h','j','m')},
{j: new Direction('i','k','0','0')},
{k: new Direction('0','0','0','j')},
{l: new Direction('0','0','i','0')},
{m: new Direction('0','i','0','0')}
]);
所以這不是
orientation.getItemAt(3).north
我能去像
orientation.getItemAt('d')north
沒有收到以下錯誤
Implicit coercion of a value of type String to an unrelated type int.
感謝你的幫助
嗯,還沒有與AS3最近的工作,但你沒有訪問字典喜歡取向[「一」],而不是orientation.a? – Aesphere 2011-12-17 09:11:05