Select to view content in your preferred language

Limiting Characters in the Search Box for Geocoding an Address

4462
8
Jump to solution
02-17-2015 02:19 PM
ChrisSergent
Deactivated User

I want to limit the number of characters a Flex application allows to enter into the Geocode an address box. How would I do that?

I would like for a box that looks like this to limit entry of characters to 110: Geocode an address—ArcGIS API for Flex | ArcGIS for Developers  - I would like for a box like

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Chris,

   You can change the mxml file but then the whole AGS Viewer for Flex Source code will have to be recompiled with the change.

  1. So you first step would be to get the AGS Viewer for Flex Source code and add it as a project in your Flex IDE.
  2. Next you will need to download the Flex API that matches the version of the AGS Viewer for Flex Source code
  3. In the AGS Viewer for Flex Source code project in your IDE you would add a src/com/esri/ags/skins/ folder to that project and then put the GeocoderSkin.mxml file in that folder (this is known as monkey patching as you are using the same folder structure as the API and it will grab your edited file instead of going to the API to get it).
  4. Make the change I outlined in the earlier post (adding the maxChars property) to the GeocoderSkin.mxml
  5. Recompile the whole AGS Viewer for Flex Source code
  6. The newly compiled AGS Viewer for Flex Source code will now reflect the change and you can deploy this monkey patched version.

View solution in original post

0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus

Chris,

  You would have to copy the GeocoderSkin.mxml in the Flex API and include it in your Flex Viewer project and modify the GeocoderSkin.mxmls textDisplay

    <!-- text -->
    <!--- @copy spark.components.supportClasses.SkinnableTextBase#textDisplay -->
    <s:RichEditableText id="textDisplay" maxChars="110"
                        left="1" right="1" top="1" bottom="1"
                        verticalAlign="middle"
                        widthInChars="10"/>

Let me know if you are unfamiliar with how to monkey patch an API Skin.

ChrisSergent
Deactivated User

I am unfamiliar with development in Flex but familiar with XML. Where is the GeocoderSkin.mxmls file so I can update the code?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Chris,

The GeocoderSkin.mxml is part of the Flex API download and is NOT included in the AGS Viewer for Flex source code. This is not as simple as modifying an xml file. So to begin with you will have to have a Flex IDE like Flash Builder. Do you have that?

ChrisSergent
Deactivated User

I have an open source tool called FlashDevelop, but that's it. I can just open files, but built a basic Esri map using it before. Will that work?

I have an engagement to make it to, but will follow up as soon as I can in the morning.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Chris,

   I can not provide any advice on using FlashDevelop. But you will have to recompile the ArcGIS Viewer for flex source code once you have monkey patched the GeocoderSkin.mxml in order to make the change to the maxChars for the Geocode component.

0 Kudos
ChrisSergent
Deactivated User

You said I can't just change the .mxml file. I'm not actually sure what a monkey patch is. What do I need to do?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Chris,

   You can change the mxml file but then the whole AGS Viewer for Flex Source code will have to be recompiled with the change.

  1. So you first step would be to get the AGS Viewer for Flex Source code and add it as a project in your Flex IDE.
  2. Next you will need to download the Flex API that matches the version of the AGS Viewer for Flex Source code
  3. In the AGS Viewer for Flex Source code project in your IDE you would add a src/com/esri/ags/skins/ folder to that project and then put the GeocoderSkin.mxml file in that folder (this is known as monkey patching as you are using the same folder structure as the API and it will grab your edited file instead of going to the API to get it).
  4. Make the change I outlined in the earlier post (adding the maxChars property) to the GeocoderSkin.mxml
  5. Recompile the whole AGS Viewer for Flex Source code
  6. The newly compiled AGS Viewer for Flex Source code will now reflect the change and you can deploy this monkey patched version.
0 Kudos
ChrisSergent
Deactivated User

Robert Scheitlin, GISP‌ can you follow me so I can send you a message?

0 Kudos