Spark Animate effect in Flex4


 

Spark Animate effect in Flex4

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

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>

0

<s:Button id="btn"

label="Spark Animate Effect"

x="3" y="45"

1

rollOverEffect="{sizeIncrease}"

rollOutEffect="{sizeDecrease}"

fontFamily="Verdana"/>

2

</s:Panel>

&</s:Application>

Output:

3

Running Application:

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

Download this code

4

Ads