Home Tutorial Flex Flex4 Components MX Fade Effect in Flex4

 
 

MX Fade Effect in Flex4
Posted on: June 26, 2010 at 12:00 AM
The Fade effect uses the alpha property for effect.

MX Fade Effect in Flex4:

The Fade effect uses the alpha property for effect. The changes of effect from transparent to opaque, or from opaque to transparent. You can specify the effect using rollOverEffect and rollOutEffect. The Tag of Fade Effect is <mx:Fade>. In this example you can see how we can use a Fade effect with component.

Example:

<?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/mx" minWidth="955" minHeight="600">

<fx:Declarations>

<mx:Fade id="imagefadeOut" alphaFrom="1.0" alphaTo="0.0" duration="1000"/>

<mx:Fade id="imagefadeIn" alphaFrom="0.0" alphaTo="1.0" duration="1000"/>

<s:RadioButtonGroup id="visibility" change="init()"/>

</fx:Declarations>

<fx:Script>

<![CDATA[

public function init():void{

if(show.selected== true){

roseindia.visible= true;

}

else{

roseindia.visible= false;

}

}

]]>

</fx:Script>

<fx:Style>

@namespace s "library://ns.adobe.com/flex/spark";

@namespace mx "library://ns.adobe.com/flex/mx";

s|RadioButton{

font-family: verdana;

font-weight:bold;

}

</fx:Style>

<s:Panel title="MX Fade effect Example"

chromeColor="#555555"

color="#CCCCCC"

width="345" height="218">

<mx:ApplicationControlBar horizontalAlign="center" width="343">

<s:RadioButton groupName="visibility" label="Show" id="show"

selected="true" color="#000000"/>

<s:RadioButton groupName="visibility" label="Hide" id="hide" color="#000000"/>

</mx:ApplicationControlBar>

<mx:Image id="roseindia"

source="@Embed(source='file:/C:/work/bikrant/image/roseindia.gif')"

hideEffect="{imagefadeOut}" showEffect="{imagefadeIn}" x="48" y="58"/>

</s:Panel>

</s:Application>

Output:

Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.

Download this code

Related Tags for MX Fade Effect in Flex4: