Share on Google+Share on Google+

HScrollBar in Flex4

Advertisement
The HScrollBar controls is used both in the MX and Spark's component. The HScrollBar control can work as a stand-alone controls, it works combinedly with other compentents as a custom component to provide scrolling functionality.

HScrollBar in Flex4:

The HScrollBar controls is used both in the MX and Spark's component. The HScrollBar control can work as a stand-alone controls, it works combinedly with other compentents as a custom component to provide scrolling functionality. It has four parts: a track, two arrow buttons, and a thumb. The width of this control is equal to the largest width of its subcomponents. The tag of HScrollbar is <s:HScrollbar>.

Example:

 <?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:mx="library://ns.adobe.com/flex/mx"

xmlns:s="library://ns.adobe.com/flex/spark">

<s:Panel title="HScrollbar Example" width="281" height="122">

<mx:HBox x="33" y="20" borderStyle="solid">

<s:VGroup>

<s:DataGroup id="item1" left="10" top="20"

clipAndEnableScrolling="true"

itemRenderer="spark.skins.spark.DefaultItemRenderer">

<s:layout>

<s:HorizontalLayout requestedColumnCount="4"/>

</s:layout>

<s:dataProvider>

<s:ArrayCollection>

<fx:String>Label</fx:String>

<fx:String>TextInput</fx:String>

<fx:String>Button</fx:String>

<fx:String>ButtonBar</fx:String>

<fx:String>ComboBox</fx:String>

<fx:String>CheckBox</fx:String>

<fx:String>RadioButton</fx:String>

<fx:String>Image</fx:String>

</s:ArrayCollection>

</s:dataProvider>

</s:DataGroup>

<s:HScrollBar id="hscroll" viewport="{item1}" width="{item1.width}"/>

</s:VGroup>

</mx:HBox>

</s:Panel>

</s:Application>

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

Posted on: May 13, 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.