<s:ArrayCollection> <fx:Object action="pan" imageIcon="assets/images/i_pan.png" label="{LocalizationUtil.getDefaultString('panLabel')}"/> <fx:Object action="zoomin" imageIcon="assets/images/i_zoomin.png" label="{LocalizationUtil.getDefaultString('zoomInLabel')}" visible="false"/> <fx:Object action="zoomout" imageIcon="assets/images/i_zoomout.png" label="{LocalizationUtil.getDefaultString('zoomOutLabel')}"/> <fx:Object action="identify" imageIcon="assets/images/i_identify.png" label="Identify" /> </s:ArrayCollection>
private function doNavAction(action:String, label:String):void { var data:Object = { tool: action, status: label } if(data.tool == "identify") { AppEvent.dispatch(AppEvent.WIDGET_RUN, ViewerContainer.getInstance().widgetManager.getWidgetId("Identify")); AppEvent.dispatch(AppEvent.SET_MAP_NAVIGATION, {tool: "Pan",status: "Pan"}); } else { AppEvent.dispatch(AppEvent.SET_MAP_NAVIGATION, data); } }
Solved! Go to Solution.
Anthony,
Try this:
private function doNavAction(action:String, label:String):void { var data:Object ={ tool: action, status: label }; if(data.tool == "identify"){ AppEvent.dispatch(AppEvent.WIDGET_RUN, ViewerContainer.getInstance().widgetManager.getWidgetId("Identify")); AppEvent.dispatch(AppEvent.SET_MAP_NAVIGATION, {tool: "pan",status: "Pan"}); var timeoutExample:uint = setTimeout(function():void{btnBar.selectedIndex = 0;},500); }else{ AppEvent.dispatch(AppEvent.SET_MAP_NAVIGATION, data); }; }
Anthony,
Try this:
private function doNavAction(action:String, label:String):void { var data:Object ={ tool: action, status: label }; if(data.tool == "identify"){ AppEvent.dispatch(AppEvent.WIDGET_RUN, ViewerContainer.getInstance().widgetManager.getWidgetId("Identify")); AppEvent.dispatch(AppEvent.SET_MAP_NAVIGATION, {tool: "pan",status: "Pan"}); var timeoutExample:uint = setTimeout(function():void{btnBar.selectedIndex = 0;},500); }else{ AppEvent.dispatch(AppEvent.SET_MAP_NAVIGATION, data); }; }
Hi Robert,
I am trying to use same code but timer clock is not going away even after adding timer. What shall i do now?
Thanks
Saurabh,
Did you add the import for ViewerContainer?
import com.esri.viewer.ViewerContainer;
Also you need to add the following line to the initButtonBar function
navAC.addItem({ label: "Identify", action: "identify", imageIcon: "assets/images/i_info.png" });
Hi robert, yes i made it working now. thanks but i want to do something different instead of opening existing widget from this location. i have started new thread for same.
Thanks for your help