Share on Google+Share on Google+

Spark Scale Effect in Flex4

Advertisement
The Scale effect is used for change the size of component or target.

Spark Scale Effect in Flex4:

The Scale effect is used for change the size of component or target. You can change the scaling in both x and y direction. The tag of Scale effect is <s:Scale>. The syntax of Scale effect is following:

<s:scale
id=""
scaleXFrom=""
scaleXto=""
scaleYFrom=""
scaleYTo=""
duration=""
/>

In this example you can see how we can use a Scale 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:Declarations>

<s:Bounce id="bounceEasing"/>

<s:Scale id="scale"

duration="500"

scaleXFrom="1.0"

scaleXTo="2.0"

scaleYFrom="1.0"

scaleYTo="2.0"

target="{vbox}"

easer="{bounceEasing}"/>

<s:Scale id="scaleresize"

duration="500"

scaleXFrom="2.0"

scaleXTo="1.0"

scaleYFrom="2.0"

scaleYTo="1.0"

target="{vbox}"

easer="{bounceEasing}"/>

</fx:Declarations>

<s:Panel title="Spark Scale effect Example"

chromeColor="#000000"

color="#CCCCCC"

width="398"

height="274">

<mx:ApplicationControlBar width="396"

horizontalAlign="center">

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

color="#000000"

fontFamily="Verdana"/>

</mx:ApplicationControlBar>

<mx:VBox id="vbox"

width="136"

height="81"

horizontalAlign="center"

verticalAlign="middle"

x="35" y="58"

backgroundColor="#555555"

borderStyle="solid">

<s:Button label="Scale"

id="btn"

cornerRadius="10"

fontFamily="Verdana"

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

<s:Button label="Scale Resize"

id="btn1"

cornerRadius="10"

fontFamily="Verdana"

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

</mx:VBox>

</s:Panel>

&</s:Application>

Output:/h3>

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: July 3, 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.