0
一直試圖滾動2個列表,其滾動條的滾動條被禁用,滾動條的右邊添加了1個滾動條。使用1個滾動條來滾動2個列表Flex 4
我試着設置每個列表的滾動條的視口,而工作只是實例化滾動到每個列表,而不是使用1
基本上我試圖讓他們在垂直滾動同時拖動只有1個滾動條的拇指。
一直試圖滾動2個列表,其滾動條的滾動條被禁用,滾動條的右邊添加了1個滾動條。使用1個滾動條來滾動2個列表Flex 4
我試着設置每個列表的滾動條的視口,而工作只是實例化滾動到每個列表,而不是使用1
基本上我試圖讓他們在垂直滾動同時拖動只有1個滾動條的拇指。
我認爲這是一個有趣的問題,並做了一點調查。這是我想出來的。
<?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"
initialize="application1_initializeHandler(event)"
creationComplete="application1_creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import flashx.textLayout.container.ScrollPolicy;
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
[Bindable] private var dp:ArrayCollection = new ArrayCollection();
protected function application1_initializeHandler(event:FlexEvent):void
{
//Add some dummy content
for (var i:int=0; i<20; i++){
dp.addItem("Test Item " + i);
}
//Turn off vertical scrolling for the two lists
list1.scroller.setStyle("verticalScrollPolicy", ScrollPolicy.OFF);
list2.scroller.setStyle("verticalScrollPolicy", ScrollPolicy.OFF);
}
protected function vScroll_changeHandler(event:Event):void
{
//Set the maximum of the one scroll bar to equal the maximum value of the hidden scroll bar
vScroll.maximum = list1.scroller.verticalScrollBar.maximum;
//Set the scroll position of the two hidden scroll bars to the value of the visible bar
list1.scroller.verticalScrollBar.value = vScroll.value;
list2.scroller.verticalScrollBar.value = vScroll.value;
}
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
//Initialize the maximum value to the value of the hidden scroll bar after data has been loaded
vScroll.maximum = list1.scroller.verticalScrollBar.maximum;
}
]]>
</fx:Script>
<s:HGroup>
<s:List id="list1" dataProvider="{dp}" height="200"/>
<s:List id="list2" dataProvider="{dp}" height="200"/>
<s:VScrollBar id="vScroll" height="200" change="vScroll_changeHandler(event)"/>
</s:HGroup>
</s:Application>