Share on Google+Share on Google+

Spinner in Flex4

Advertisement
Flex4 introduced a new a Spinner control which was not available in MX. In Flex4 Spinner control is called a Spark component.

Spinner control in Flex4:

Flex4 introduced a new a Spinner control which was not available in MX. In Flex4 Spinner control is called a Spark component. You can set the values and select the values by clicking up and down button in Spinner control. The tag of Spinner control is <s:Spinner>.

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

<s:Panel title="Spinner Control Example" x="0" y="0" width="278" height="250">

<s:VGroup width="240" height="197" left="26" top="10">

<s:HGroup>

<mx:Text text="Use the arrows to change tabs:"/>

<s:Spinner id="spinner1" maximum="3"/>

</s:HGroup>

<mx:TabNavigator id="tabnav" width="230" height="75%"

 selectedIndex="@{spinner1.value}">

<mx:HBox label="C">

<s:Label text="C is a procedural based language."/>

</mx:HBox>

<mx:HBox label="JAVA">

<s:Label text="JAVA is a object oriented language."/>

</mx:HBox>

<mx:HBox label="HTML">

<s:Label text="HTML is used for designing a web page."/>

</mx:HBox>

<mx:HBox label="ORACLE">

<s:Label text="ORACLE is a database."/>

</mx:HBox>

</mx:TabNavigator>

</s:VGroup>

</s:Panel>

</s:Application>

In this example you can see how we can use a Spinner control in Flex4.

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: May 12, 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.