ActionScript 3 从字符串动态添加属性

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 从字符串动态添加属性相关的知识,希望对你有一定的参考价值。

var mc:MovieClip = new MovieClip(); // make new object

// these strings can come from flashvars, arrays etc
var n:String = "tallness"; // this is the property
var v:String = "100 miles"; // this is the value for the property

// assign the property and value at the same time
mc[n] = v;

trace(mc.tallness); // traces: 100 miles

以上是关于ActionScript 3 从字符串动态添加属性的主要内容,如果未能解决你的问题,请参考以下文章