Home Tutorial Flex Flex4 Components Spark Animate effect in Flex4

 
 

Spark Animate effect in Flex4
Posted on: July 2, 2010 at 12:00 AM
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

Related Tags for Spark Animate effect in Flex4:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.