Mega Code Archive

 
Categories / Flex / Effects
 

Apply a Dissolve effect to the first Panel container, and apply a Dissolve effect to a RoundedRectange instance overlaid on top of

<!-- Code from Flex 4 Documentation "Using Adobe Flex 4". This user guide is licensed for use under the terms of the Creative Commons Attribution  Non-Commercial 3.0 License.  This License allows users to copy, distribute, and transmit the user guide for noncommercial  purposes only so long as    (1) proper attribution to Adobe is given as the owner of the user guide; and    (2) any reuse or distribution of the user guide contains a notice that use of the user guide is governed by these terms.  The best way to provide notice is to include the following link.  To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ -->     <!-- behaviors\PanelDissolve.mxml --> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"     xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark"     creationComplete="init();">     <s:layout>         <s:VerticalLayout />     </s:layout>     <fx:Script>                    import mx.geom.*;          // Define a bounding box for the target area of the effect.          [Bindable]          public var tArea:RoundedRectangle;          // Size the bounding box to the size of Panel 2.          private function init():void          {              tArea = new RoundedRectangle(0,0, panel2.width, panel2.height, 5);          }             </fx:Script>     <fx:Declarations>         <mx:Dissolve id="dissolveP1" duration="1000" target="{panel1}"             alphaFrom="1.0" alphaTo="0.0" />         <!-- Apply the effect to the bounding box, not to Panel 2. -->         <mx:Dissolve id="dissolveP2" duration="1000" target="{panel2}"             alphaFrom="1.0" alphaTo="0.0" targetArea="{tArea}" />     </fx:Declarations>     <mx:Panel id="panel1" title="Panel 1" width="100" height="140">         <mx:Button label="Orange" />     </mx:Panel>     <mx:Panel id="panel2" title="Panel 2" width="100" height="140">         <mx:Button label="Red" />     </mx:Panel>     <mx:Button label="Dissolve Panel 1" click="dissolveP1.end();dissolveP1.play();" />     <mx:Button label="Dissolve Panel 2" click="dissolveP2.end();dissolveP2.play();" /> </s:Application>