protected function widgetClosedHandler(event:Event):void { timeSlider.pause(); map.timeSlider = null; map.timeExtent = null; }
timeSlider.thumbIndexes = [timeSlider.timeStops.length - 1];
timeSlider.slider.setThumbValueAt(timeSlider.thumbCount - 1, 0)
Leen, Sure, this now you do it:timeSlider.slider.setThumbValueAt(timeSlider.thumbCount - 1, 0)Don't forget to click the Mark as answer check on this post and to click the top arrow (promote) as shown below:
<viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:viewer="com.esri.viewer.*" xmlns:esri="http://www.esri.com/2008/ags" widgetConfigLoaded="init()">
protected function init():void { trace ("init view track"); if (configXML) { layerNAM= configXML.layername; if (layerNAM != null) { for each (var layer:Layer in map.layers) { if (layer.id==configXML.layername) { fLayer=layer as ArcGISDynamicMapServiceLayer; if (fLayer.visible==false) { fLayer.visible=true; } timeInfo=fLayer.timeInfo; map.timeSlider = myTimeSlider; myTimeSlider.createTimeStopsByTimeInterval(timeInfo.timeExtent,1,TimeInfo.UNIT_MINUTES); break; } } } } }
protected function widgetOpenedHandler(event:Event):void { init(); }
protected function widgetClosedHandler(event:Event):void { myTimeSlider.pause(); map.timeSlider = null; map.timeExtent = null; myTimeSlider.slider.setThumbValueAt(myTimeSlider.thumbCount - 1, 0); //reset to starting position myTimeSlider.createTimeStopsByTimeInterval(timeInfo.timeExtent,1,TimeInfo.UNIT_MINUTES); //reset to 1 min interval fLayer.visible=false; }
<viewer:WidgetTemplate id="timeTrack" width="580" height="250" closed="widgetClosedHandler(event)" open="widgetClosedHandler(event)">
I had found that code but did not understand it however, in this context I do. It works!You are really helping me out! Thanks again!!Leen
protected function widgetOpenedHandler(event:Event):void { map.timeSlider = timeSlider; if(timeInfo){ timeSlider.slider.setThumbValueAt(timeSlider.thumbCount - 1, 0); myTimeSlider.createTimeStopsByTimeInterval(timeInfo.timeExtent,1,TimeInfo.UNIT_MINUTES); } }
timeSlider.thumbIndexes = [0];
timeSlider.slider.setThumbValueAt(timeSlider.thumbCount - 1, timeSlider.slider.maximum);
Leen, It turns out after talking to Dasa from the Flex API team this week while I am at the Dev Summit I was making this more complicated than it needed to be. All you have to do is this one line:timeSlider.thumbIndexes = [0]; and that resets the time extent and the slider back to the beginning.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.