flex实现滑动显示隐藏效果
鼠标划过的时候显示菜单栏 ,鼠标移开后隐藏菜单栏。比较常用的一种动画效果。附件是源代码。
大家多多交流
<?xml version="1.0"?>
<!-- Simple example to demonstrate the Move effect. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()">
??? <mx:Script>
??????? <![CDATA[
???import mx.controls.Alert;
???
???private function init():void{
????img.y=0-(img.height*0.90);//初始默认将百分之九十的图片隐藏起来。通过y轴的福坐标来设置
???}
???
???//当鼠标覆盖的时候 将图片显示出来
??????????? private function moveMOverImage():void {
??????????????? myMove.end();
??????????????? myMove.yTo=0;
??????????????? myMove.play();
??????????? }
???????????
??????????? //鼠标移开的时候在将图片重新隐藏
??????????? private function moveMOutImage():void {
??????????????? myMove.end();
??????????????? myMove.yTo=0-(img.height*0.90);
??????????????? myMove.play();
??????????? }
???????????
???????????
????? ]]>
??? </mx:Script>
?
??? <mx:Move id="myMove" target="{img}"? />
?
??? <mx:Panel title="Move Effect Example" width="95%" height="95%"
??????? paddingTop="5" paddingLeft="10" paddingRight="10" paddingBottom="5">
?
??????? <mx:Canvas id="canvas" width="100%" height="100%" >
??????????? <mx:Image id="img" source="@Embed(source='beijing.png')"?? mouseOver="moveMOverImage();" mouseOut="moveMOutImage();" />
??????? </mx:Canvas>
???
??? </mx:Panel>
</mx:Application>