Apply MX Effect using Style in Flex4


 

Apply MX Effect using Style in Flex4

In this example you can see how we can apply the effect to the component using Style.

In this example you can see how we can apply the effect to the component using Style.

Apply MX Effect using Style in Flex4:

In this example you can see how we can apply the effect to the component using Style. We have to use a Image component for apply the rollOverEffect and rollOutEffect using Style.

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

<!-- Apply Effect using Style -->

<fx:Style>

@namespace s "library://ns.adobe.com/flex/spark";

@namespace mx "library://ns.adobe.com/flex/mx";

mx|Image{

rollOverEffect:orbitZoomON;

rollOutEffect:orbitZoomOFF;

}

</fx:Style>

<fx:Declarations>

<mx:Zoom id="orbitZoomON"

duration="500"

originX="55"

originY="55"

zoomHeightTo="3.5"

zoomWidthTo="3.5"/>

<mx:Zoom id="orbitZoomOFF"

duration="500"

originX="55"

originY="55"

zoomHeightTo="1.0"

zoomWidthTo="1.0"/>

</fx:Declarations>

<s:Panel title="Apply MX Effect using Style"

0

width="487" height="350"

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

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

1

<s:Label text="Take a coursor on image and show the effect."

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

</mx:ApplicationControlBar>

2

<mx:Image id="roseindia" cacheAsBitmap="true"

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

x="179" y="115" height="91" width="128"/>

3

</s:Panel>

</s:Application>

Output:

4

Running Application:

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

Download this code

5

Ads