Share on Google+Share on Google+

Spark Animate effect in Flex4

Advertisement
Spark Animate effect animates any property of the component or target.

Spark Animate Effect in Flex4:

Spark Animate effect animates any property of the component or target. In this example we create a instance of the SimpleMotionPath class for each property to animate. The tag of Animate effect is <s:Animate>. The syntax of Animate effect is following:

<s:Animate
id=""
target=""
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:Animate id="sizeIncrease"

target="{btn}" duration="500">

<s:SimpleMotionPath property="scaleX"

valueFrom="1.0" valueTo="2.0"/>

<s:SimpleMotionPath property="scaleY"

valueFrom="1.0" valueTo="2.0"/>

</s:Animate>

<s:Animate id="sizeDecrease"

target="{btn}" duration="500">

<s:SimpleMotionPath property="scaleX"

valueFrom="2.0" valueTo="1.0"/>

<s:SimpleMotionPath property="scaleY"

valueFrom="2.0" valueTo="1.0"/>

</s:Animate>

</fx:Declarations>

<s:Panel title="Spark Animate 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 Animate Effect"

x="3" y="45"

rollOverEffect="{sizeIncrease}"

rollOutEffect="{sizeDecrease}"

fontFamily="Verdana"/>

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