Share on Google+Share on Google+

Spark Fade effect in Flex4

Advertisement
The Fade effect uses the alpha property for effect. The changes of effect from transparent to opaque, or from opaque to transparent.

Spark 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 <s:Fade>.
In this example you can see how we can use a Fade effect with component. The syntax of Fade effect is following:

<s:Fade
id=""
alphaFrom=""
alphaTo=""
duration=""
/>

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>

<s:Fade id="fadeON" alphaFrom="0.5" alphaTo="1.0" duration="200"/>

<s:Fade id="fadeOFF" alphaFrom="1.0" alphaTo="0.5" duration="200"/>

</fx:Declarations>

<s:Panel title="Spark Fade Effect Example"

chromeColor="#000000"

color="#CCCCCC" width="309" height="184">

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

<s:Label text="Mouse over on button and show the effect"

color="#000000"

fontFamily="Verdana"/>

</mx:ApplicationControlBar>

<s:Button id="btn"

label="Spark Fade Effect"

x="83" y="62"

rollOverEffect="{fadeON}"

rollOutEffect="{fadeOFF}"

fontFamily="Verdana" height="37"

alpha="0.5"

cornerRadius="20"/>

</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

Advertisements

Posted on: July 2, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.