Coz it's a quick and nasty (but working) example, and I have zero knowledge about the finer details of the slider controls :)
On Thu, Aug 7, 2008 at 9:28 AM, Tim Hoff <[EMAIL PROTECTED]> wrote: > Hey Josh, > > What's up with: > > return item.value >= > Math.min(priceSlider.values[0],priceSlider.values[1]) && > item.value <=Math.max(priceSlider.values[0],priceSlider.values[1]); > > You can avoid this by setting allowThumbOverlap="false". Then just use: > > return item.value >= priceSlider.values[0] && item.value > <=priceSlider.values[1); > > -TH > > --- In flexcoders@yahoogroups.com, "Josh McDonald" <[EMAIL PROTECTED]> wrote: > > > > Complete example with 2 thumbs (from the earlier example): > > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > layout="absolute"> > > > > <mx:Script> > > <![CDATA[ > > import mx.collections.ArrayCollection; > > > > [Bindable] > > private var allProducts : Array = [ > > { > > name: "Datsun 120y", > > value : 1000 > > }, > > { > > name: "Nissan 350Z", > > value : 55000 > > }, > > { > > name: "Porsche GT3", > > value : 325000 > > }, > > { > > name: "HSV Clubsport", > > value : 79999 > > }, > > { > > name: "Mercedes SLR", > > value : 1200000 > > }, > > { > > name: "Lada Niva", > > value : 75 > > }, > > { > > name: "Ford Falcon XY GTHO", > > value : 375000 > > }, > > { > > name: "Batmobile", > > value : 654321 > > }, > > { > > name: "Ford Falcon XA GTHO", > > value : 2200000 > > }]; > > > > [Bindable] > > private var filteredList : ArrayCollection = new > > ArrayCollection(allProducts); > > > > private function updateFilter() : void > > { > > filteredList.filterFunction = myFilterFunction; > > filteredList.refresh(); > > } > > > > private function myFilterFunction(item : Object) : Boolean > > { > > return item.value >= > > Math.min(priceSlider.values[0],priceSlider.values[1]) && item.value <= > > Math.max(priceSlider.values[0],priceSlider.values[1]); > > } > > > > ]]> > > </mx:Script> > > > > <mx:DataGrid horizontalCenter="0" verticalCenter="0" width="410" > > height="354" dataProvider="{filteredList}"> > > <mx:columns> > > <mx:DataGridColumn headerText="Car Name" dataField="name"/> > > <mx:DataGridColumn headerText="Value" dataField="value"/> > > </mx:columns> > > </mx:DataGrid> > > <!--<mx:HSlider verticalCenter="-191" horizontalCenter="0" minimum="0" > > maximum="2000000" id="min" liveDragging="true" change="updateFilter()"/> > > <mx:HSlider verticalCenter="191" horizontalCenter="0" minimum="0" > > maximum="2000000" id="max" liveDragging="true" change="updateFilter()" > > value="2000000"/> > > <mx:Label text="Min" textAlign="right" width="117" > > horizontalCenter="-147" verticalCenter="-191"/> > > <mx:Label text="Max" textAlign="right" width="117" > > horizontalCenter="-147" verticalCenter="191"/>--> > > > > <mx:HSlider horizontalCenter="0" verticalCenter="-200" id="priceSlider" > > minimum="0" > > maximum="3000000" tickInterval="100000" snapInterval="10" > > thumbCount="2" values="[0,3000000]" tickColor="#ffffff" > > labels="[$0k,$3000000M]" liveDragging="true" width="182" > > change="updateFilter()"/> > > > > </mx:Application> > > > > > > On Thu, Aug 7, 2008 at 2:39 AM, Tim Hoff [EMAIL PROTECTED] wrote: > > > > > > > > And go back to your original filterFunction: > > > > > > if ( (city_cb.selectedLabel == "All" || item.city == > > > city_cb.selectedLabel) && (lct_cb.selectedLabel == "All" || > > > item.location == lct_cb.selectedLabel) && (item.value > > > > priceSlider.values[0] && item.value < priceSlider.values[1]) > > > ){ > > > result=true; > > > } > > > return result; > > > } > > > > > > priceSlider.values[3000000] doesn't exist. Then as Alex suggests, walk > > > through the code with the debugger, or trace. > > > > > > -TH > > > > > > --- In flexcoders@yahoogroups.com, "Tim Hoff" TimHoff@ wrote: > > > > > > > > > > > > Yeah shoot, my bad. Take the values property out of the tag. Should > > > > have said set the min to 0 and the max to 3,000,000 (like you have > it. > > > > The "values" will lock the thumbs to those two positions (values) > > > only. > > > > > > > > -TH > > > > > > > > --- In flexcoders@yahoogroups.com, "Josh McDonald" dznuts@ wrote: > > > > > > > > > > Shows how often I use the sliders. I didn't know you could use > > > > multiple > > > > > thumbs... This is not performant, you should be getting the max and > > > > min > > > > > within updateFilter() and sticking them in private vars, not in the > > > > filter > > > > > function itself... but you get the idea. > > > > > > > > > > private function myFilterFunction(item : Object) : Boolean > > > > > { > > > > > return item.value >= > > > > > Math.min(priceSlider.values[0],priceSlider.values[1]) && item.value > > > <= > > > > > Math.max(priceSlider.values[0],priceSlider.values[1]); > > > > > } > > > > > > > > > > > > > > > On Wed, Aug 6, 2008 at 5:29 PM, stinasius stinasius@ wrote: > > > > > > > > > > > i managed to build a dual thumb slider that i pass on the filter > > > > > > function. here is the code. > > > > > > > > > > > > <mx:HSlider x="0" y="240" id="priceSlider" minimum="0" > > > > > > maximum="3000000" tickInterval="100000" snapInterval="10" > > > > > > thumbCount="2" values="[0,3000000]" tickColor="#ffffff" > > > > > > labels="[$0k,$3000000M]" liveDragging="true" width="182" > > > > > > change="filterGrid()"/> > > > > > > > > > > > > > > > > > > ------------------------------------ > > > > > > > > > > > > -- > > > > > > Flexcoders Mailing List > > > > > > FAQ: > > > > http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > > > > > > Search Archives: > > > > > > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! > > > > Groups > > > > > > Links > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > "Therefore, send not to know For whom the bell tolls. It tolls for > > > > thee." > > > > > > > > > > :: Josh 'G-Funk' McDonald > > > > > :: 0437 221 380 :: josh@ > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------ > > > > > > -- > > > Flexcoders Mailing List > > > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > > > Search Archives: > > > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups > > > Links > > > > > > > > > > > > > > > > > > -- > > "Therefore, send not to know For whom the bell tolls. It tolls for thee." > > > > :: Josh 'G-Funk' McDonald > > :: 0437 221 380 :: [EMAIL PROTECTED] > > > > -- "Therefore, send not to know For whom the bell tolls. It tolls for thee." :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]