Flex4开始出现“外观”这个词。
外观、样式是并存的,都是用来实现程序看得见部分的样子。
有什么不同呢?
作用的对象和范围不同。
看下面的“外观”代码(http://www.adobe.com/cn/devnet/flex/articles/flex4_skinning.html):
它将呈现一种看得见的形态,既可以作用于按钮,又可以做用于其他组件。
Skin1.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" alpha.disabled=".5">
<!-- states -->
<s:states>
<s:State name="up" />
<s:State name="over" />
<s:State name="down" />
<s:State name="disabled" />
</s:states>
<!-- border and fill -->
<s:Rect id="rect" radiusX="4" radiusY="4" top="0" right="0" bottom="0" left="0">
<s:fill>
<s:SolidColor color="0x77CC22" />
</s:fill>
<s:stroke>
<s:SolidColorStroke color="0x131313" weight="2"/>
</s:stroke>
</s:Rect>
<!-- text -->
<s:Label text="Button!" color="0x131313"
textAlign="center" verticalAlign="middle"
horizontalCenter="0" verticalCenter="1"
left="12" right="12" top="6" bottom="6"
/>
</s:Skin>
相比之下,样式作用于更具体的一种样子属性,比如外观中的颜色(color),对齐方式(textAlign)等。