MX Fade Effect in Flex4


 

MX Fade Effect in Flex4

The Fade effect uses the alpha property for effect.

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>

0

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

chromeColor="#555555"

color="#CCCCCC"

1

width="345" height="218">

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

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

2

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

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

</mx:ApplicationControlBar>

3

<mx:Image id="roseindia"

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

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

4

</s:Panel>

</s:Application>

Output:

5

Running Application:

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

Download this code

6

Ads