Flex Class object(类对象)构成、traits和prototype
先贴张图:

每个矩形代表一个对象。CA代表class A本身,它持有三个引用:TA是实例特征对象(traits object),存储了实例的属性,这些属性是由该类定义的。TCA是类特征对象(class traits object),代表了类的内部类型并了该类定义的存储静态属性。PA是原型对象(prototype object),它总是关联着由构造函数(constructor)属性最初添加的类对象。
?
实际上,prototype算是个历史遗留问题。在as1.0中,prototype是用来实现class定义和继承的:
?
// base classfunction Shape() {}// Create a property named visible.Shape.prototype.visible = true;// Make Circle a subclass of Shape.?
// Make Circle a subclass of Shape.Circle.prototype = new Shape();
?
这样,Circle就相当于继承了Shape。
?
到了AS2.0,已经添加了一些新的关键字,class,?extends,?public,?private等,但prototype的作用还是一样的,extends关键字只不过简化了创建子类的过程。
-as3 和?-es,分别代表AS3和ECMAScript。
Adobe Flex Builder and Adobe Flash CS3 Professional的默认编译设置是?-as3 = true 和?-es = false.
?
?
参考:
http://livedocs.adobe.com/flex/3/html/help.html?content=04_OO_Programming_12.html#136347