POST
|
I found this code very helpful. I have added a text box and area text box to allow for a subject and comment block to be added to the email. I know that my coding is very crude, and I'm looking for input on how to better write it. <?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.*">
<fx:Script>
<![CDATA[
import com.esri.ags.geometry.MapPoint;
import com.esri.ags.utils.WebMercatorUtil;
import mx.controls.Alert;
[Bindable]
private var EmailComment:String;
// Sends data to email file
// Ref: http://forums.arcgis.com/threads/41459-Create-Email-with-Hyperlink-to-share-map-extent
// Ref: http://stackoverflow.com/questions/6841136/mailto-with-attachments-in-flex-or-air-applications
// Ref: http://zoomquiet.org/res/scrapbook/ZqSKM/data/20100419224556/
private function mailme():void
{
var currentCenter:MapPoint = (map.extent.center) as MapPoint;
var u:String = "";
u+= "mailto:mappers@site.com";
u+= "?";
u+= "subject=";
u+= emailSubject.text;
u+= " ";
u+= "&body=http://url/siteweb/?center="
+ myDegreeFormatter.format(currentCenter.x)
+ ","
+ myDegreeFormatter.format(currentCenter.y)
+ "%26"
+ "scale="
+ Math.round(map.scale)
+ "%0D%0A" + "%0D%0A" //Creates two blank lines
+ emailComment.text;
var url:URLRequest= new URLRequest(u);
navigateToURL(url);
}
private function getURLParameters():Object
{
var result:URLVariables = new URLVariables();
try
{
if (ExternalInterface.available)
{
// Use JavaScript to get the search string from the current browser location.
// Use substring() to remove leading '?'.
// See http://livedocs.adobe.com/flex/3/langref/flash/external/ExternalInterface.html
var search:String = ExternalInterface.call("location.search.substring", 1);
if (search && search.length > 0)
{
result.decode(search);
}
}
}
catch (error:Error)
{
Alert.show(error.toString());
}
return result;
}
private function setMapLocation():void
{
var params:Object = getURLParameters();
if (params["ll"])
{
var latlong:Array = String(params.ll).split(",");
if (latlong.length == 2)
{
map.centerAt(new MapPoint(latlong[1], latlong[0]));
}
}
if (params["scale"])
{
map.scale = params.scale;
}
}
]]>
</fx:Script>
<fx:Declarations>
<mx:NumberFormatter id="myDegreeFormatter"
precision="0"
useThousandsSeparator="false"/>
</fx:Declarations>
<viewer:WidgetTemplate id="passURL" widgetTitle="Pass URL" width="100%" height="100%">
<s:VGroup id="groupURL">
<s:Label
text="Subject: "/>
<s:TextInput id="emailSubject"/>
<s:Label
text="Comment: "/>
<s:TextArea id="emailComment"
maxChars="250"/>
<s:Button click="mailme()"
fontSize="12"
fontWeight="bold"
label="Report Error"/>
</s:VGroup>
</viewer:WidgetTemplate>
</viewer:BaseWidget>
... View more
03-06-2012
12:39 PM
|
0
|
0
|
496
|
POST
|
I think I found the place in the code, similar to your example but with some changes. From what I gather I can use the string.replace as a starting point for my function. Since the repl parameter in the .replace can also be a function. See below, sound correct? if (queryLayer)
{
var query:Query = new Query();
var myPattern:RegExp = /\[value\]/g;
var expr:String;
// adds quotes to the string to be used for SQL query
value = value.replace("'","''");
expr = queryExpr.replace(myPattern, mySubStringFunctionResult);
query.where = expr;
query.outSpatialReference = map.spatialReference;
if(queryDefExpr != "")
queryLayer.definitionExpression = queryDefExpr;
queryLayer.queryFeatures(query, new AsyncResponder(onResult, onFault, queryFields));
showMessage(loadingLabel, true);
showStateResults();
... View more
02-29-2012
08:06 AM
|
0
|
0
|
226
|
POST
|
Here is what I am trying to do. Within the SearchWidget.xml I want the user to input the search like the example shown below. A function is called passing the user inputted value. The function then parses the string into sub-substrings and re-arranges the sting to match how the data is shown in the database in this case "23-J, 104-A-10" would become "104A10023". What I'm asking is where would I put this function in the SearchWidget.mxml. Your thoughts/ideas? <expressions>
<expression alias="Grid Unit"
textsearchlabel="Search by Grid Unit [Example: 23-J, 104-A-10]:">Grid_ID LIKE ('%[value]%')</expression>
</expressions>
... View more
02-29-2012
06:33 AM
|
0
|
3
|
929
|
POST
|
I am encountering a problem where say I select a feature and the results appear in the data grid. If I then select another feature (tool still active) the results in the data grid are not updated until I hover over the record. What I need is a event listener that listens for each new redraw and refreshes the results. My question is where would I put this in the code? Thanks
... View more
02-06-2012
07:02 AM
|
0
|
0
|
577
|
POST
|
Ok, so some of the widget is working however still get NaN (not a number) as shown here. Any ideas to why? [ATTACH=CONFIG]11615[/ATTACH]
... View more
02-01-2012
11:23 AM
|
0
|
0
|
1191
|
POST
|
UPDATE: Figured out what was effecting the coordinates... My Extents! <map wraparound180="true" initialextent="-57193000 5667000 -50956000 8828000" fullextent="-20000000 -20000000 20000000 20000000" top="40"> If I use the default extents that come with the flex viewer <map wraparound180="true" initialextent="-14083000 3139000 -10879000 5458000" fullextent="-20000000 -20000000 20000000 20000000" top="40"> It works fine, use this tool to determine your extents, whatever way I did before messed it up. http://help.arcgis.com/en/webapi/flex/samples/index.html#/Map_Extent_and_Mouse_Coordinates/01nq0000002w000000/
... View more
02-01-2012
07:42 AM
|
0
|
0
|
1191
|
POST
|
UPDATE: I created a new flex viewer with the coordinate menu widget, Vancouver now shows up correctly. X: -13706323.186011488 Y: 6320134.462034756 So something is wrong with my original flex viewer, if you have any ideas of what to fix that would be great.
... View more
02-01-2012
07:06 AM
|
0
|
0
|
1191
|
POST
|
UPDATE: Did a little test, maybe this will help narrow things down. Copy Map X Y Coordinates to clipboard Vancouver My Map X: -53780981.811385006 Y: 6318025.736052506 Vancouver Coordinate Menu Widget X: -13707478.753861206 Y: 6320901.449768862 Vancouver: MyMap with Operational Layer Projected in WGS 1984 Web Mercator X: -53781471.008366026 Y: 6318514.933033532 Map Service is not public but I think you looking for this information. I noticed that the Spatial Reference is 3857 and not 102101 or 4326, issue? VWeb (MapServer)
View In: ArcMap ArcGIS Explorer ArcGIS JavaScript Google Earth ArcGIS.com Map
View Footprint In: Google Earth
Service Description:
Map Name: Layers
All Layers and Tables
Layers:
Base (0)
Surface_Features (1)
Seismic Line (2)
Urban (3)
Urban Center (4)
Community (5)
Towns (6)
Water (7)
Annotation_Water_20K (8)
Annotation Class 1 (9)
Annotation_Water_50K (10)
Annotation Class 1 (11)
Water_Line_20k (12)
Water_Line_50k (13)
Water_Polygon_20k (14)
Water_Polygon_50k (15)
Water_Line_250K (16)
Water_Polygon_Islands_250K (17)
Water_Polygon_2mil (18)
Water_Line_2mil (19)
Water_Pacfic_oc_Provincial_Shoreline (20)
Roads (21)
Roads x1 (22)
Roads x2 (23)
Roads x3 (24)
Oil & Gas (25)
Wellsites (26)
Pipeline_R/W (27)
Grids (28)
UTM_TARGET (29)
BCGS_Index (30)
PNG (31)
P&NG Group (32)
Letter Block (33)
Unit (34)
Number Block (35)
Mapsheet (36)
District_Lots (37)
Administrative Boundaries (38)
Land_Use_Background (39)
Tenure (40)
Forestry (41)
Cutblocks (42)
Tables:
Description:
Copyright Text:
Spatial Reference: 3857
Single Fused Map Cache: false
Intial Extent:
XMin: -13458714.8258235
YMin: 7595516.94052755
XMax: -13431961.8659237
YMax: 7606370.99854403
Spatial Reference: 3857
Full Extent:
XMin: -18305842.9979
YMin: 5552185.1391
XMax: 840681.6802
YMax: 14793217.5532
Spatial Reference: 3857
Units: esriMeters
Supported Image Format Types: PNG32,PNG24,PNG,JPG,DIB,TIFF,EMF,PS,PDF,GIF,SVG,SVGZ,BMP
Document Info:
Title:
Author:
Comments:
Subject:
Category:
Keywords:
AntialiasingMode: None
TextAntialiasingMode: Force
Supported Interfaces: REST SOAP
Supported Operations: Export Map Identify Find Generate KML
... View more
02-01-2012
06:19 AM
|
0
|
0
|
1191
|
POST
|
Here is my code. Geographic Coordinate Systems
http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/index.html?gcs.html
-->
<coordinateSystems>
<coordinateSystem name="NAD 1983 UTM Zone 10" wkid="26910" decimals="4"/>
<coordinateSystem name="NAD 1927 UTM Zone 10" wkid="26710" decimals="4"/>
<coordinateSystem name="Web Mercator" wkid="102101" decimals="4"/>
<coordinateSystem name="GCS WGS 1984 (Decimal Degrees)" wkid="4326" decimals=""/>
<coordinateSystem name="World Mercator" wkid="54004" decimals="4"/>
<!-- <coordinateSystem name="GCS WGS 1984 (Decimal Degrees)" wkid="4326" decimals="2"/> -->
</coordinateSystems>
<!-- Zoom To Coordinate Scale -->
<zoomScale>5000</zoomScale>
</configuration> I tried the default code and still get the same problem, shows up as NaN for Lat / Long. If I turn off my operational layers, and only run the base maps, I still run into the same problem.
... View more
02-01-2012
05:56 AM
|
0
|
0
|
1191
|
POST
|
I get the following "NaN" in all boxes. Yet I still have Lat / Long being displayed in the bottom left corner of the map. I am using the geometry service that comes default with this widget, if I use my own service or another esri geometry service it says cannot find projection.... Any ideas on what is wrong. I am using the correct WKID's for my Coordinate systems drop down. And my .mxd was projected to WGS 1984 Web Mercator (Auxiliary Sphere). [ATTACH=CONFIG]11603[/ATTACH] UPDATE: I turned off all basemaps and left only my operational layer, the tool now somewhat works. I think it has to do with my projection of my .mxd and that of ESRI basemaps. Does it Matter that I am using WGS 1984 Web Mercator (Auxiliary Sphere) instead of just WGS 1984 Web Mercator? One other thing to note is that the Lat/Long still does not show up [ATTACH=CONFIG]11604[/ATTACH]
... View more
02-01-2012
04:46 AM
|
0
|
0
|
1191
|
POST
|
You can try something like this featureLayer.minScale = 100000; <!--Min scale at which appears--> featureLayer.maxScale = 0; or Within the declarations tags <esri:GraphicsLayer id="myGraphicsLayer" minScale="1500000"/> Go here for overall understanding http://resources.esri.com/help/9.3/arcgisserver/apis/flex/apiref/com/esri/ags/layers/Layer.html#isInScaleRange
... View more
06-19-2011
02:29 PM
|
0
|
0
|
167
|
POST
|
I am trying to edit the icon sizes within the headercontroller, can't seem to find where to do this. Any Ideas?
... View more
06-12-2011
01:07 PM
|
0
|
0
|
626
|
POST
|
I have modified the HeaderControler Widget so that is it quite short and only includes a few widgets. I am trying to move the widget under the MapSwitcherWidget which is on the top right corner of the screen. Example: <!-- UI elements --> <splashpage label="Your Guide to Conservation Areas in Ontario" config="widgets/mySplash/SplashWidget.xml" url="widgets/MySplash/SplashWidget.swf"/> <widget left="10" top="135" config="widgets/Navigation/NavigationWidget.xml" url="widgets/Navigation/NavigationWidget.swf"/> <!-- widget right="-2" bottom="-2" config="widgets/OverviewMap/OverviewMapWidget.xml" url="widgets/OverviewMap/OverviewMapWidget.swf"/ --> <widget right="30" top="5" config="widgets/MapSwitcher/MapSwitcherWidget.xml" url="widgets/MapSwitcher/MapSwitcherWidget.swf"/> <widget right="30" top="30" config="widgets/HeaderController/HeaderControllerWidget.xml" url="widgets/HeaderController/HeaderControllerWidget.swf"/> Problem is with these settings the widget shows up flush on the left side of the screen. The only way I have been able to move the widget is the following: <widget left="1450" top="30" config="widgets/HeaderController/HeaderControllerWidget.xml" url="widgets/HeaderController/HeaderControllerWidget.swf"/> However this is only visible on large monitors... Is there some code that is forcing the HeaderController to the right side of the screen? Do you know of any workarounds to getting the widget in the correct location? Thanks.
... View more
06-12-2011
11:17 AM
|
0
|
0
|
691
|
POST
|
@KenBuja OK so I was able to get it to run without errors using the code you provided. I added dg.addEventListener(ListEvent.ITEM_CLICK, dg_ItemRollOver, false, 0, true); dg.addEventListener(ListEvent.ITEM_ROLL_OUT, dg_ItemRollOut, false, 0 ,true); dg.addEventListener(ListEvent.ITEM_ROLL_OVER, dg_ItemRollOver, false, 0, true); as well as the following code. I think there is something wrong in my function findGraphicByAttribute(attributes:Object):Graphic but I'm not to sure. The most frustrating thing is the first part of the code works (the mouse events) but not the second half... any thoughts would be most appreciated. //Creates graphic for each point, adds attribute data for each point to array
var results:ArrayCollection = new ArrayCollection;
function onResult(featureSet:FeatureSet, token:Object = null):void
{
if (featureSet.features.length > 0)
{
for each (var myGraphic3:Graphic in featureSet.features)
{
//Adds a mouseover event for the graphic
myGraphic3.addEventListener( MouseEvent.MOUSE_OVER, onMouseOver );
myGraphic3.addEventListener( MouseEvent.MOUSE_OUT, onMouseOut );
myGraphic3.symbol = resultsSymbol;
myGraphicsLayer.add(myGraphic3);
results.addItem(myGraphic3.attributes);
map.addLayer(myGraphicsLayer);
dg.visible = true;
dg.dataProvider = results;
function onMouseOver( event : MouseEvent ) : void
{
var graphic : Graphic = Graphic( event.target );
graphic.symbol = highlightSymbol;
for each( var attributes : Object in dg.dataProvider )
{
if (attributes === graphic.attributes)
{
dg.selectedIndex = (dg.dataProvider as ArrayCollection).getItemIndex(attributes)
}
}
dg.scrollToIndex(dg.selectedIndex);
}
function onMouseOut( event : MouseEvent ) : void
{
Graphic( event.target ).symbol = resultsSymbol;
dg.selectedIndex = -1;
}
function dg_ItemRollOut(event:ListEvent):void
{
findGraphicByAttribute(event.itemRenderer.data).symbol = resultsSymbol;
}
function dg_ItemRollOver(event:ListEvent):void
{
findGraphicByAttribute(event.itemRenderer.data).symbol = highlightSymbol;
}
function findGraphicByAttribute(attributes:Object):Graphic
{
for each (var graphic:Graphic in myGraphicsLayer.graphicProvider)
{
if (graphic.attributes == attributes)
{
return graphic;
}
}
return null;
}
}
}
... View more
05-24-2011
05:28 PM
|
0
|
0
|
436
|
POST
|
So I have been still playing around with this... I have added the following to the datagrid itemRollOut="onItemRollOver(event)" itemRollOver="onItemRollOut(event)"> I now get the following error Type 1180: Call to a possibly undefined method onItemRollOut. 1180: Call to a possibly undefined method onItemRollOver. Both of these are defined as functions above... I have read that this error can mean that you have not imported all the necessary classes. I have double checked and looks like I have them all. I was able to find this forum that is what I am trying to do. But they still have onItemRollOut defined the same way... This code also has similar functionality to what I am looking for.
... View more
05-24-2011
11:29 AM
|
0
|
0
|
436
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|