从性能角度来看,哪个功能定义更好/更快?创建一个对象并为其添加功能,或者逐个创建功能?哪种方式更适合在AS3中定义函数?
var myCollection:Object = {
first: function(variable:int):void {
},
second: function(variable:int):void {
}
}
myCollection.first(1);
或
private function first(variable:int):void {
}
private function second(variable:int):void {
}
first(1);
其次是更快,因为它没有额外的费用,不得不寻找一个对象来找到函数。 – BadFeelingAboutThis 2013-03-22 23:40:25