if (bWidget){ var bWidg:BaseWidget = bWidget.getInstance(); var vSW:SearchWidget = bWidg as SearchWidget; vSW.queryParam(xParam); } else { var bWidget2:IBaseWidget; bWidget2 = SiteContainer.getInstance().widgetManager.getWidget(id) as IBaseWidget; var vSW2:SearchWidget = bWidget2 as SearchWidget; vSW2.queryParam(xParam); }
Jon, Sure here is the code to change in the MapManager.mxml //map load complete private function mapLoadComplete(event:MapEvent):void { //My Add map.zoomSliderVisible = false; map.logoVisible = false; try { if (ExternalInterface.available) { var timer:Timer; var result:URLVariables = new URLVariables(); var urlSubstring:String = ExternalInterface.call("window.location.search.substring", 1); if (urlSubstring && urlSubstring.length > 0 && urlSubstring != "debug=true") { result.decode(urlSubstring); // Parse URL var xExt:String; var xUrlParam:String; if (result["EXT"]) xExt = result.EXT; if (!xExt == ""){ var extArray:Array = xExt.split(","); var extent:Extent = new Extent(Number(extArray[0]), Number(extArray[1]), Number(extArray[2]), Number(extArray[3]),map.spatialReference); map.extent = extent; } } } } catch (error:Error){} //End My Add }to use it just append something like: ?EXT=644988.5757,1173575.0875,645690.0041,1173863.1558 to the url.
//map load complete private function mapLoadComplete(event:MapEvent):void { //My Add map.zoomSliderVisible = false; map.logoVisible = false; try { if (ExternalInterface.available) { var timer:Timer; var result:URLVariables = new URLVariables(); var urlSubstring:String = ExternalInterface.call("window.location.search.substring", 1); if (urlSubstring && urlSubstring.length > 0 && urlSubstring != "debug=true") { result.decode(urlSubstring); // Parse URL var xExt:String; var xUrlParam:String; if (result["EXT"]) xExt = result.EXT; if (!xExt == ""){ var extArray:Array = xExt.split(","); var extent:Extent = new Extent(Number(extArray[0]), Number(extArray[1]), Number(extArray[2]), Number(extArray[3]),map.spatialReference); map.extent = extent; } } } } catch (error:Error){} //End My Add }
question:can the ?EXT take just a single set of coords? i am interested in having it zoom to a pt instead of a poly.
Steve,I've successfully modified the code to pass a parcel ID in the URL. The map opens and zooms to the parcel which has been overlaid by a graphic. I'm attaching a text file with explanations and code.Marc
Marc,are there any changes to this code for it to be 2.3.x compatible?
mark, i dont see the attached txt file.love to have give it a try.
I made this ability pretty easy (well documented), and very configurable in the eSearch widget. Have you looked at it?
Marc, Actually it works fine in Flex Viewer 2.3.1 also. Event know esri removed the mapLoadComplete function I have you add it back and use it for my purposes instead.
Marc, It will work just fine. So you can go back to your function.
protected override function partAdded(partName:String, instance:Object):void { map.logoVisible = false; super.partAdded(partName, instance); if (instance == map) { var cssStyleDeclaration:CSSStyleDeclaration = styleManager.getStyleDeclaration ("com.esri.ags.components.supportClasses.InfoWindow") cssStyleDeclaration.setStyle("backgroundColor", getStyle('contentBackgroundColor')); styleManager.setStyleDeclaration("com.esri.ags.components.supportClasses.InfoWindow", cssStyleDeclaration, true); map.addEventListener(MapEvent.LOAD, mapLoadComplete); changeESRILogo(map); } }
Marc, I just tested it and it works.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.