您的位置:首页 > 其它

Flex动态类属性添加及访问

2013-04-10 15:30 232 查看
动态类作用主要是根据自己的需要添加自己想要的属性,其中Object就是一个动态类。

下面为动态类属性添加的两种方法:

internal function testObject():void{
var student:Object = new Object();
student.name = "小王";
student.age = 20;
student.type = "本科";

for(var prop:String in student){
trace(prop+":"+student[prop]);
}

}


internal function testObject():void{
var student:Object = new Object();
student["name"] = "小王";
student["age"] = 20;
student["type"] = "本科";

for each(var prop:String in student){
trace(prop);
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: