Spark EasingClasses in Flex4


 

Spark EasingClasses in Flex4

The easing classes is used for change the acceleration of an effect.

The easing classes is used for change the acceleration of an effect.

Spark Easing Classes in Flex4:

The easing classes is used for change the acceleration of an effect. The package of easing classes is spark.effects.easing package. There are different easing classes which are following:

1. Bounce
2. Elastic
3. Linear
4. Power
5. Sine

In this example you can see how we can use easing classes with effects in your application.

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:Bounce id="bounceEasing"/>

<s:Power id="powerEasing"

exponent="4"/>

<s:Move id="moveRight"

xFrom="4"

xTo="450/font>"

duration="2000"

easer="{{bounceEasing}"

target="{roseindia}/font>"//>

<s:Move id="moveLeft"

xFrom="450"

xTo="4"

duration="2000"

easer="{powerEasing}"

target="{roseindia}"/>

</fx:Declarations>

<s:Panel title="Spark Easing Classes Example/font>&"

chromeColor="#000000/font>"

color="#CCCCCC"

width="602"

height="228"&>

<mx:ApplicationControlBar

width="600"

horizontalAlign="center/font>">

<s:Button id="btn1"

label="Move Forword"

click="{moveLeft.end();moveLeft.play();}"/>

<s:Button id="btn"

label="Move Backword"

click="{moveRight.end();moveRight.play();}"/>

</mx:ApplicationControlBar>

<s:Label text="Click on Buttons for showing the effect"

color="#000000"

fontFamily="Verdana" x="179" y="41"/>

<mx:Image id="roseindia"

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

x="463" y="60"

width="128" height="128"/>

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

Ads