Share on Google+Share on Google+

MX Move Effect in Flex4

Advertisement
The component move from one point to another point by using Move effect.

MX Move Effect in Flex4:

The component move from one point to another point by using Move effect. You will set the xFrom, yFrom, xTo, yTo, xBy and yBy property for moving a component. The tag of Move effect is <mx:Move>. The Move effect uses the following syntax:

<mx:Move
id="ID"
xFrom="val"
yFrom="val"
xTo="val"
yTo="val"
xBy="val"
yBy="val"
/>

In this example you can see how we can use a Move effect With components.

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:Script>

<![CDATA[

import mx.effects.easing.*;

]]>

</fx:Script>

<fx:Declarations>

<mx:Move id="moveON" duration="1500" xBy="-200"/>

<mx:Move id="moveOFF" duration="1500" xBy="200"/>

</fx:Declarations>

<s:Panel title="MX Move Effect Example"

width="487" height="228"

chromeColor="#000000" color="#CCCCCC">

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

<s:Label text="Click on image and show the effect."

fontFamily="verdana" color="#000000"/>

</mx:ApplicationControlBar>

<mx:Image id="roseindia"

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

x="253" y="57"

mouseDownEffect="{moveON}" mouseUpEffect="{moveOFF}"

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

Advertisements

Advertisement

Posted on: June 28, 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.