Select to view content in your preferred language

Modifying the ArcGIS viewer for flex source code

683
2
09-27-2012 11:37 PM
MarcinDruzgala
Frequent Contributor
Hi i've got two questions about Viewer for Flex source code. Im completely new to AS3 and MXML so it's a bit hard for me to navigate through the entire code.

1. Let's say i've copied all that i needed for the "Mapswitcher" widget to my new flex project(a lot of files are needed to be honest, I thought that only few classes and mxml files will be required...). Now im digging in these files to get knowledge about how is this widget working and where i can modify this code to for e.g provide my own services to populate the basemap button(?) - so here is my first question - can someone point in which file i should look for it. I did find a "PortalBasemapAppender.as" - in this class file i've found a function named "portal_queryItemResultHandler" and i think im a bit closer but still the "portalURL" variable is only declared in that file(as a String). While debugging i've found that basemaps URLs are taken from one of the esri sites. And that they are a written as a JSONs(i'm not sure if this is correct formulation). What i would like to do is: get URL list from my own created file(is XML appropriate?)  but i dont want to change the whole logic for the basemapappender so i need to do it with JSON notation - so the getJSONData function will work. I hope you do understand my problem, i've tried to make it understandable.

2. Can someone give me some tips how to navigate in the viewer source code? I know that this require a few weeks maybe(as i mentioned i'm completely new to Flex, i have some experience with c# but it's surely not the same - working with MXML and AS3 is a bit hard for me for now) to get a grip on this source code and use it efficiently in my application.

Thanks in advance!
Tags (2)
0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus
MDruzgala,

   So the first thing I will tell you about is the dedicated Flex Viewer forum where this post really belongs in the future:

http://forums.arcgis.com/forums/111-ArcGIS-Viewer-for-Flex

One of the most important things to understand about the Viewer is you need the WHOLE project to modify and build individual widgets. Many years ago the Sample Flex Viewer (now just the Flex Viewer) came with a dedicated viewer swc so that you could do as you are attempting, but now this is not an option.

   You begin by importing the WHOLE Flex Viewer project in your Flash Builder app and then you can modify individual widgets like the MapSwitcherWidget.mxml. Inside the Flex Viewer src zip file you will find a readme.txt that walks you through the import process in Flash Builder. Start There.

Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow the steps as shown in the below graphic:

0 Kudos
BjornSvensson
Esri Regular Contributor
...where i can modify this code to for e.g provide my own services to populate the basemap button(?)...


FYI: For that specific example, you do not need to modify any source code.  You can just add your own services in the config.xml.
http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/Map_Switcher_widget/01m30000003...

To learn more about developing with the source code, it will really help if you have a basic understanding of ActionScript and Flex.  Adobe has good information at their web site, e.g. free Flex-in-a-week videos at http://www.adobe.com/devnet/flex/videotraining.html.  Once you know a litle about ActionScript & Flex (or if you think you can just wing that), then head over to http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/Getting_started_for_developers/... for more information.
0 Kudos