The following example shows how you can display scroll tips in a Flex List control by setting the showScrollTips property. You can also customize the scroll tip text by setting a custom scroll tip function using the scrollTipFunction property.
Full code after the jump.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/03/28/displaying-scroll-tips-in-a-list-control-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
import mx.controls.scrollClasses.ScrollBarDirection;
import mx.utils.StringUtil;
private function list_scrollTipFunc(dir:String, pos:Number):String {
var pct:Number = pos / list.maxVerticalScrollPosition;
return StringUtil.substitute("{0} / {1} ({2}%)",
pos, // current
list.maxVerticalScrollPosition, // max
numberFormatter.format(pct * 100) // percent
);
}
]]>
</mx:Script>
<mx:NumberFormatter id="numberFormatter" precision="0" />
<mx:Array id="arr">
<mx:Object label="Accordion" />
<mx:Object label="ApplicationControlBar" />
<mx:Object label="Box" />
<mx:Object label="Canvas" />
<mx:Object label="ControlBar" />
<mx:Object label="DividedBox" />
<mx:Object label="Form" />
<mx:Object label="FormHeading" />
<mx:Object label="FormItem" />
<mx:Object label="Grid" />
<mx:Object label="HBox" />
<mx:Object label="HDividedBox" />
<mx:Object label="Panel" />
<mx:Object label="TabNavigator" />
<mx:Object label="Tile" />
<mx:Object label="TitleWindow" />
<mx:Object label="VBox" />
<mx:Object label="VDividedBox" />
<mx:Object label="ViewStack" />
</mx:Array>
<mx:ApplicationControlBar dock="true">
<mx:CheckBox id="checkBox"
label="showScrollTips:"
labelPlacement="left"
selected="true" />
</mx:ApplicationControlBar>
<mx:List id="list"
dataProvider="{arr}"
rowCount="6"
showScrollTips="{checkBox.selected}"
scrollTipFunction="list_scrollTipFunc"
verticalScrollPolicy="on" />
</mx:Application>
View source is enabled in the following example.



{ 4 comments… read them below or add one }
I don’t think this sample is working, I don’t see the scrolltip being displayed regardless of the checkbox status.
Rafael,
I see the scroll tip in the example above (using WinXP/FP9,0,115,0/IE7). It’s a little hard to see since it is actually over the List control itself.
Peter
Hi Peter
I am using a multiselect listbox how will I access the values in another page (ASP) selected when the page is submitted.
Based on the selection I need to select some records from database.
If you need the source code I will send it to you
Regards,
Arulmurugan . T
Web Developer
I think the confusion on the tooltip not showing isn’t that it isn’t showing (it is), but the expectations. I was initially expecting to see content tooltips as I moused over ‘TabNavigator’, ‘Tile’, etc. What this is doing is adding Tooltips to the scroll bar — which is exactly what it says it is doing… lol