类有方法从给定对象中更新其实例属性 。
出于某种原因, 在 ActionScript 3 中绕过 this
的属性失败 。
我试过一些东西,比如:
class myThing() {
public var A:String;
public var B:String;
public var C:String;
...
public function bindToObject( obj:Object){
for( var s in this){
if( obj.hasOwnProperty(s)) this[s] = obj[s];
}
}
}
这样循环就不会执行, 好像 this
没有任何属性一样 。
请以聪明的方式 将对象属性复制给我班级的一例