0
public class SndFx
{
[Embed(source="Sounds/01.mp3")]
public static const s01:Class;
public static const s01s:Sound = new s01() as Sound;
[Embed(source="Sounds/02.mp3")]
public static const s02:Class;
public static const s02s:Sound = new s02() as Sound;
[etc...]
}
我可以動態訪問這些屬性嗎?我有其中的許多聲音我想打球,我想要做這樣的事情:as3 - 動態訪問類屬性
SndFx["s"+numberStr+"s"].play();
填充字典是我最終做的。您可以使用此[[「]動態訪問屬性。 – quano 2009-12-24 15:10:44