在Flex4.5中实现的一个简单的例子:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<mx:HBox label="blendMode:">
<s:ComboBox id="comboBox" selectedIndex="0">
<s:dataProvider>
<s:ArrayCollection>
<fx:String>{BlendMode.ADD}</fx:String>
<fx:String>{BlendMode.ALPHA}</fx:String>
<fx:String>{BlendMode.DARKEN}</fx:String>
<fx:String>{BlendMode.DIFFERENCE}</fx:String>
<fx:String>{BlendMode.ERASE}</fx:String>
<fx:String>{BlendMode.HARDLIGHT}</fx:String>
<fx:String>{BlendMode.INVERT}</fx:String>
<fx:String>{BlendMode.LAYER}</fx:String>
<fx:String>{BlendMode.LIGHTEN}</fx:String>
<fx:String>{BlendMode.MULTIPLY}</fx:String>
<fx:String>{BlendMode.NORMAL}</fx:String>
<fx:String>{BlendMode.OVERLAY}</fx:String>
<fx:String>{BlendMode.SCREEN}</fx:String>
<fx:String>{BlendMode.SHADER}</fx:String>
<fx:String>{BlendMode.SUBTRACT}</fx:String>
</s:ArrayCollection>
</s:dataProvider>
</s:ComboBox>
</mx:HBox>
<s:Ellipse id="ellipse1"
width="100"
height="100"
horizontalCenter="-25"
verticalCenter="-25">
<s:fill>
<s:SolidColor color="red" />
</s:fill>
</s:Ellipse>
<s:Ellipse id="ellipse2"
width="100"
height="100"
horizontalCenter="25"
verticalCenter="-25">
<s:fill>
<s:SolidColor color="blue" />
</s:fill>
</s:Ellipse>
<s:HGroup id="e3" width="100" height="100" horizontalCenter="0" verticalCenter="25">
<s:Ellipse id="ellipse3"
blendMode="{comboBox.selectedItem}"
width="100"
height="100"
horizontalCenter="0"
verticalCenter="25">
<s:fill>
<s:SolidColor color="green" />
</s:fill>
</s:Ellipse>
</s:HGroup>
</s:Application>
效果:
add:
darken:
还有很多,自己去试试吧....