Flex 4: 一个向左移动 像右移动的效果

<?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/halo" 
               width
="500" height="300">
    
<s:layout>
        
<s:BasicLayout/>
    
</s:layout>

    
<fx:Script>
        
<![CDATA[
            protected function clickHandler(event:MouseEvent):void
            {
                // TODO Auto-generated method stub
                effect.end();
                effect.xTo = test.x == 490 ? 200 : 490;
                effect.play();
            }
        
]]>
    
</fx:Script>

    
<fx:Declarations>
        
<!-- Place non-visual elements (e.g., services, value objects) here -->
        
<s:Move id="effect" target="{test}"/>
    
    
</fx:Declarations>
    
<s:Border backgroundColor="0xff0000" backgroundAlpha="0.4" width="100%" height="100%">
        
<s:layout><s:BasicLayout/></s:layout>
        
<s:Panel id="test" title="我是移动的Panel" 
                 x
="200" y="5" width="290" height="290" 
                 backgroundColor
="0x00ff00"
                 click
="clickHandler(event)"/>
    
</s:Border>
</s:Application>
原文地址:https://www.cnblogs.com/Fooo/p/1593711.html