有谁能告诉我如何使用flex 3创建摆动效果? 当我们看到警报或移动文件夹时,我需要像ubuntu中显示的效果。
谢谢。
答案 0 :(得分:0)
不确定Flex中是否有专门用于处理“摆动”效果的内容,但您可以结合使用Flex Move和反弹效果来创建一种“摆动”:
<?xml version="1.0"?>
<fx:Declarations>
<s:Bounce id="bounceEasing"/>
<s:Elastic id="elasticEasing"/>
<s:Move id="moveRight"
target="{myImage}"
xBy="500"
duration="2000"
easer="{elasticEasing}"/>
<s:Move id="moveLeft"
target="{myImage}"
xBy="-500"
duration="2000"
easer="{bounceEasing}"/>
</fx:Declarations>
<s:Image id="myImage"
source="@Embed(source='assets/logo.jpg')"/>
<s:Button label="Move Right"
x="0" y="100"
click="moveRight.end();moveRight.play();"/>
<s:Button label="Move Left"
x="0" y="125"
click="moveLeft.end();moveLeft.play();"/>
自定义上面的代码以进行较小的移动并链接左右移动,并且您有一个摆动。您可能还决定为MouseEvent.ROLL_OVER添加一个事件侦听器,以便在鼠标滑过组件时播放摆动效果。