Mega Code Archive

 
Categories / Flex / Effects
 

Fly fade effect

<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#eeeeee"   mouseUp="currentState=''">   <mx:states>     <mx:State name="detail">       <mx:AddChild position="lastChild">         <mx:Image id="detailImage" x="300" y="50" source="assets/{currentImage}"/>       </mx:AddChild>     </mx:State>   </mx:states>      <mx:transitions>     <mx:Transition fromState="*" toState="detail">       <mx:Parallel target="{detailImage}">         <mx:Move id="customMove" xFrom="0" yFrom="0" xTo="300" yTo="50"/>         <mx:Zoom zoomHeightFrom="0" zoomWidthFrom="0" zoomHeightTo="1" zoomWidthTo="1"/>       </mx:Parallel>     </mx:Transition>          <mx:Transition fromState="detail" toState="*">       <mx:Sequence target="{detailImage}">         <mx:Fade alphaFrom="1" alphaTo="0"/>         <mx:RemoveChildAction/>         <mx:Fade alphaTo="1"/>       </mx:Sequence>     </mx:Transition>        </mx:transitions>      <mx:Script>                 [Bindable]       private var currentImage:String;            private function showDetail(event:MouseEvent):void       {         customMove.xFrom = event.stageX;         customMove.yFrom = event.stageY;                  currentImage = event.currentTarget.getRepeaterItem();         currentState = "detail";       }       </mx:Script>   <mx:Image width="100" height="75" source="a.jpg" mouseDown="showDetail(event)"/>    </mx:Application>