Quantcast
Channel: Forums - ArcGIS Viewer for Flex
Viewing all articles
Browse latest Browse all 2097

customizing the Link Widget, having some issues

$
0
0
I've got a widget that is specifically intended to, when clicked, zoom the map view to a specified extent that relates to the boundary of a park.

For example, when first launched, the viewer zooms to a particular extent related to the detailed feature that was selected by the user on the previous web page. Then, if the user wants to view the entire park (such as to see the entire park and all features included within the park boundary), the "Zoom to Park" Widget (aka Link Widget) button takes the Park Code (bolded/underlined in the URL below) as it relates to the current mapped feature, and zooms the map to the extent of the particular park.
localhost/Viewer/index.html?NPS_List_ID=BLRI_L04R-01-BAC_ROANOKE%20RIVER

This widget worked in the previous viewer, as is, but when I brought it into the updated viewer (Flex 3.0) it no longer works. (see image).
Attachment 18367

What it does is "reload" the header bar on top of the eSearch datagrid, then shifts the new header and the two open widget windows slightly to the right and slightly off-screen (and in Fiddler, when this button is clicked, there are no http requests reported)...it's so strange and I can't figure out why there's this odd behavior. Does anyone have any ideas? I'm certain there is something I am missing, but I don't know where to start to look for what the issue is. I can't see that there are any Flex API changes that should affect this widget, but I could be (or likely am) wrong about this.

Widget (mxml) code if it'll help. The config for the widget has only the url in it, as required. Again, this widget works perfectly (as is) in the Viewer built on Flex 2.5, but not the new Flex 3.0.
Code:

<?xml version="1.0" encoding="utf-8"?>
<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.*"
                                  widgetConfigLoaded="init()">
        <fx:Script>
                <![CDATA[
                        import com.esri.viewer.AppEvent;
                        import com.esri.viewer.ViewerContainer;
                        import com.esri.viewer.WidgetStates;
                       
                        import flash.net.URLRequest;
                        import flash.net.URLVariables;
                       
                        private var linkURL:String;
                       
                        import Globals;
                       
                        private function init():void
                        {
                                if (configXML)
                                {
                                        linkURL = configXML.linkurl;
                                        var request:URLRequest = new URLRequest(linkURL);
                                        var urlVars:URLVariables = new URLVariables; //("Unit_Code")
                                        urlVars.parkNames = Globals.Unit_Code;
                                        request.data = urlVars;
                                        request.method = URLRequestMethod.POST;
                                        trace(request.url + " and " + request.data);
                                        navigateToURL(request,"_self");
                                        setState(WidgetStates.WIDGET_CLOSED);
                                }
                                AppEvent.addListener(AppEvent.WIDGET_RUN, checkIfLinkWidget);
                                //ViewerContainer.addEventListener(AppEvent.WIDGET_RUN, checkIfLinkWidget);
                        }
                       
                        private function checkIfLinkWidget(aEvent:AppEvent):void
                        {
                                if(aEvent.data == widgetId)
                                {
                                        navigateToURL(new URLRequest(linkURL));
                                        setState(WidgetStates.WIDGET_CLOSED);
                                }
                        }
                ]]>
        </fx:Script>
</viewer:BaseWidget>

Attached Thumbnails
Click image for larger version

Name:	10-11-2012 11-46-13 AM.jpg‎
Views:	N/A
Size:	98.1 KB
ID:	18367  

Viewing all articles
Browse latest Browse all 2097

Trending Articles