|
POST
|
Step by step. Do you have the same logic as in SearchWidget/BookmarkWidget/... ? [ATTACH=CONFIG]14006[/ATTACH] where each SearchResult is: var searchResult:SearchResult = new SearchResult();
searchResult.title = title;
searchResult.content = content;
searchResult.point = getGeomCenter(graphic);
searchResult.link = link ? link : null;
searchResult.linkAlias = linkAlias;
searchResult.geometry = graphic.geometry;
searchResult.graphic = graphic; Right?
... View more
05-02-2012
04:44 AM
|
0
|
0
|
1310
|
|
POST
|
This way we work with selection symbol:
...
private var selectionSMS:SimpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 30, 0x00FF00, 0.5);
// private var selectionSMS:SimpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 6, 0x000000, 0);
...
/**
* Listen feature layer update end handler
*/
protected function onFeatureLayerUpdated(event:LayerEvent):void
{
if (featureLayer.selectedFeatures != null && featureLayer.selectedFeatures.length > 0)
{
Graphic(featureLayer.selectedFeatures[0]).symbol = selectionSMS; // for points
}
}
... View more
04-26-2012
12:02 AM
|
0
|
0
|
859
|
|
POST
|
LayerEvent.UPDATE_END event.updateSuccess <?xml version="1.0" encoding="utf-8"?>
<s:Application 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:esri="http://www.esri.com/2008/ags">
<!-- Adobe Flex SDK 4.6.0 -->
<!-- ArcGIS API for Flex 3.0 prerelease 15.03.2012 -->
<!-- web.zone.ee/bespiva/layerevents -->
<s:layout>
<s:VerticalLayout paddingBottom="10"
paddingLeft="10"
paddingRight="10"
paddingTop="10"
gap="10" />
</s:layout>
<esri:Map id="map">
<esri:extent>
<esri:WebMercatorExtent id="lowerManhatten"
minlon="-74.03" minlat="40.70" maxlon="-73.99" maxlat="40.72"/>
</esri:extent>
<esri:ArcGISTiledMapServiceLayer name="Base Layer"
url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
load="onLayerLoad(event)"
loadError="onLayerLoadError(event)"
updateStart="onLayerUpdateStart(event)"
updateEnd="onLayerUpdateEnd(event)"/>
<esri:ArcGISDynamicMapServiceLayer name="Census Block Points"
url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/"
visibleLayers="{new ArrayCollection([0])}"
load="onLayerLoad(event)"
loadError="onLayerLoadError(event)"
updateStart="onLayerUpdateStart(event)"
updateEnd="onLayerUpdateEnd(event)"/>
<esri:ArcGISDynamicMapServiceLayer name="Census Block Group"
url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/"
visibleLayers="{new ArrayCollection([1])}"
load="onLayerLoad(event)"
loadError="onLayerLoadError(event)"
updateStart="onLayerUpdateStart(event)"
updateEnd="onLayerUpdateEnd(event)"/>
<esri:ArcGISDynamicMapServiceLayer name="Coarse Counties"
url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/"
visibleLayers="{new ArrayCollection([3])}"
load="onLayerLoad(event)"
loadError="onLayerLoadError(event)"
updateStart="onLayerUpdateStart(event)"
updateEnd="onLayerUpdateEnd(event)"/>
<esri:ArcGISDynamicMapServiceLayer name="Detailed Counties"
url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/"
visibleLayers="{new ArrayCollection([4])}"
load="onLayerLoad(event)"
loadError="onLayerLoadError(event)"
updateStart="onLayerUpdateStart(event)"
updateEnd="onLayerUpdateEnd(event)"/>
</esri:Map>
<s:Label text="Logs:" />
<s:VGroup width="100%"
height="100%">
<s:TextArea width="100%"
height="100%"
id="log" />
</s:VGroup>
<fx:Script>
<![CDATA[
import com.esri.ags.events.LayerEvent;
import mx.collections.ArrayCollection;
import mx.utils.StringUtil;
private var loadedCount:int;
private var nonLoadedCount:int;
private var updateStartedCount:int;
private var updateEndedCount:int;
private function addLog(message:String):void
{
log.text = StringUtil.substitute("{0}\n\n{1}", message, log.text);
}
protected function onLayerLoadError(event:LayerEvent):void
{
addLog(StringUtil.substitute("Error on loading layer {0}", event.layer.name));
nonLoadedCount++;
var mapLayersCount:int = ArrayCollection(map.layers).length;
if (mapLayersCount == (nonLoadedCount + loadedCount))
{
addLog(StringUtil.substitute("Loaded: {0} of {1} layers\n {2} layers fault on loading.",
loadedCount, mapLayersCount, nonLoadedCount));
}
}
protected function onLayerLoad(event:LayerEvent):void
{
addLog(StringUtil.substitute("{0} is loaded", event.layer.name));
loadedCount++;
var mapLayersCount:int = ArrayCollection(map.layers).length;
if (mapLayersCount == (nonLoadedCount + loadedCount))
{
addLog(StringUtil.substitute("Loaded: {0} of {1} layers\n {2} layers fault on loading.",
loadedCount, mapLayersCount, nonLoadedCount));
}
}
protected function onLayerUpdateStart(event:LayerEvent):void
{
addLog(StringUtil.substitute("{0} update started", event.layer.name));
if (updateStartedCount == updateEndedCount)
{
updateStartedCount = updateEndedCount = 0; // reset
}
updateStartedCount++;
}
protected function onLayerUpdateEnd(event:LayerEvent):void
{
addLog(StringUtil.substitute("{0} update ended >> update success = {1}",
event.layer.name, event.updateSuccess));
updateEndedCount++;
if (updateStartedCount == updateEndedCount)
{
addLog("All layers are updated");
}
}
]]>
</fx:Script>
</s:Application>
... View more
04-24-2012
02:42 AM
|
0
|
0
|
1317
|
|
POST
|
Andrew, I do not understand what you want to hear, listening myfLayer.addEventListener(GraphicEvent.GRAPHIC_ADD,fLayer_graphicAddHandler);? How are going to add "Graphic"? As I understand, for FeatureLayer add() is not supported. What is your task? Why fLayer_graphicAddHandler needed? <?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
backgroundColor="0x9c9c9c">
<!-- Adobe Flex SDK 4.6.0 -->
<!-- ArcGIS API for Flex 3.0 prerelease 15.03.2012 -->
<!-- web.zone.ee/bespiva/layerwithoutmap -->
<s:layout>
<s:VerticalLayout gap="10"
paddingLeft="10"
paddingRight="10"
paddingTop="10"
paddingBottom="10" />
</s:layout>
<s:Label text="Load layer:" />
<s:HGroup width="100%">
<s:TextInput id="txtUrl"
width="100%"
text="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Fire/Sheep/MapServer/0" />
<s:Button label="Load"
click="onLoadButtonClick(event)" />
</s:HGroup>
<s:Label text="Query results table:" />
<s:VGroup width="100%"
height="50%">
<s:DataGrid width="100%"
height="100%"
dataProvider="{gridProvider}" />
</s:VGroup>
<s:Label text="Logs:" />
<s:VGroup width="100%"
height="100%">
<s:TextArea width="100%"
height="100%"
id="log" />
</s:VGroup>
<fx:Script>
<![CDATA[
import com.esri.ags.FeatureSet;
import com.esri.ags.Graphic;
import com.esri.ags.events.LayerEvent;
import com.esri.ags.layers.FeatureLayer;
import com.esri.ags.tasks.supportClasses.Query;
import mx.collections.ArrayCollection;
import mx.rpc.AsyncResponder;
import mx.rpc.Fault;
import mx.utils.StringUtil;
[Bindable]
private var gridProvider:ArrayCollection = new ArrayCollection();
private var activeLayer:FeatureLayer = null;
private function addLog(message:String):void
{
log.text = StringUtil.substitute("{0}\n\n{1}", message, log.text);
}
protected function onLoadButtonClick(event:MouseEvent):void
{
addLog("onLoadButtonClick()");
if (txtUrl.text.length > 0)
{
initLayer(txtUrl.text);
}
else
{
addLog("Layer url is empty. Enter valid layer url.");
}
}
private function initLayer(url:String):void
{
addLog("initLayer()");
if (activeLayer)
{
gridProvider = null;
activeLayer.removeEventListener(LayerEvent.LOAD, onLayerLoad);
activeLayer.removeEventListener(LayerEvent.LOAD_ERROR, onLayerLoadError);
}
activeLayer = new FeatureLayer(url);
activeLayer.mode = FeatureLayer.MODE_SNAPSHOT;
activeLayer.outFields = new Array("*"); // all
activeLayer.addEventListener(LayerEvent.LOAD, onLayerLoad, false, 0, true);
activeLayer.addEventListener(LayerEvent.LOAD_ERROR, onLayerLoadError, false, 0, true);
dispatchEvent(new LayerEvent(LayerEvent.LOAD, activeLayer));
}
protected function onLayerLoad(event:LayerEvent):void
{
addLog("onLayerLoad()");
queryFeatures();
}
protected function onLayerLoadError(event:LayerEvent):void
{
addLog("onLayerLoadError()");
}
private function queryFeatures():void
{
addLog("queryFeatures()");
if (activeLayer)
{
var query:Query = new Query();
query.returnGeometry = false;
query.where = "1=1"; // all
activeLayer.queryFeatures(query, new AsyncResponder(onQueryResult, ouQueryFault, activeLayer));
}
}
protected function onQueryResult(featuresSet:FeatureSet, token:Object = null):void
{
addLog("onQueryResult()");
var queryLayer:FeatureLayer = activeLayer as FeatureLayer;
if (activeLayer != queryLayer)
{
return;
}
gridProvider = new ArrayCollection();
for each (var gr:Graphic in featuresSet.features)
{
gridProvider.addItem(gr.attributes);
}
}
protected function ouQueryFault(fault:Fault, token:Object = null):void
{
addLog(StringUtil.substitute("ouQueryFault()\n{0}", fault.message.toString()));
}
]]>
</fx:Script>
</s:Application>
... View more
04-23-2012
11:14 PM
|
0
|
0
|
1686
|
|
POST
|
Andrew, but I want to do this without adding another layer to the map. var layer:Layer = map.getLayer("Metadata");
var myfLayer:FeatureLayer = new FeatureLayer(layer.url + "/0");
myfLayer.id = "MetadataFeatureLayer";
myfLayer.addEventListener(GraphicEvent.GRAPHIC_ADD,fLayer_graphicAddHandler);
// add layer/table load event listener
myfLayer.addEventListener(LayerEvent.LOAD, onLayerLoad, false, 0, true);
dispatchEvent(new LayerEvent(LayerEvent.LOAD, myfLayer)); // the code you looked for
// map.addLayer(myfLayer);
...
/*
* Listen layer load handler
*/
protected function onLayerLoad(event:LayerEvent):void
{
// now you can work with loaded layer/table
} Good luck.
... View more
04-22-2012
11:01 PM
|
0
|
0
|
1686
|
|
POST
|
Chamara, Form adobe: Cross-domain policy file specification A cross-domain policy file is an XML document that grants a web client�??such as Adobe Flash Player, Adobe Reader, etc.�??permission to handle data across multiple domains. ... From ArcGIS API for FLEX help: About using crossdomain.xml To access data from a different server other than the one hosting your Flex application, the remote server needs to have a cross-domain file in the root directory. ... From ArcGIS FLEX Viewer help: Getting Started If this service is not running in the same web server, your ArcGIS Server will need a crossdomain.xml file. ... Your ArcGIS server (or any other used server) must return http://server.arcgisonline.com/crossdomain.xml or use proxy.
... View more
04-18-2012
10:27 PM
|
0
|
0
|
631
|
|
POST
|
Do not gone through, but read carefully. Conceptually, a widget is a chunk of code that provides functionality in the ArcGIS Viewer for Flex application. The Viewer application has an extensible widget programming model and supports modular functionality. For example, one widget enables Viewer application end-users to switch between base maps in the map display; a different widget provides functionality to find a location in the map; while another widget provides an overview map for the Viewer. You never do it for own application. "Never" means that if you do not have the experience and you do not understand "How it is made" - you can not do that. "Never" means that if you understand "How it is made" - you do not want to do it. (it is hard work - to dig into someone else's code)
... View more
04-18-2012
12:43 AM
|
0
|
0
|
922
|
|
POST
|
1 - If you download widgets from Code Gallery. For example: Roberts search widget has README file: https://github.com/rscheitlin/eSearch/blob/master/README with detailed description "How to install compiled version" and "How to install non compiled version"... 2 - If you play with samples in Viewer ESRI developers provide us with help pages: http://help.arcgis.com/en/webapps/flexviewer/help/index.html#/Creating_widgets/01m300000010000000/ the most common mistake here: 4 - Compile your widget, like any other Flex module. In Flash Builder, with the Flex Viewer project open, go to Project > Properties > Flex modules. Click Add, click Browse, then navigate to your new widget .mxml file. Click OK three times. At what stage you have a bug?
... View more
04-17-2012
11:21 PM
|
0
|
0
|
922
|
|
POST
|
Bjorn, we had same problem some times ago.. here is sample application (based on ESRI "Measure Line sample") with sources Length measuring (draw tool + geometry service) != scale bar measured value.
... View more
04-16-2012
11:28 PM
|
0
|
0
|
4514
|
|
POST
|
Clement, query task parameters are request query strings. Take a look to Example usage tag in this help page. try it: encodeURIComponent() query.text = encodeURIComponent(chinese character street name)
... View more
04-16-2012
01:49 AM
|
0
|
0
|
707
|
|
POST
|
Map units are the first loaded layer units. Until ESRI developers complete reference (or fix bugs), you can use first layer units: <?xml version="1.0" encoding="utf-8"?>
<s:Application 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:esri="http://www.esri.com/2008/ags">
<s:layout>
<s:VerticalLayout />
</s:layout>
<fx:Script>
<![CDATA[
import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;
import com.esri.ags.layers.Layer;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
protected function button1_clickHandler(event:MouseEvent):void
{
var layer:Layer = getMapFirstLayer();
if (layer != null)
{
var message:String = "";
if (layer is ArcGISTiledMapServiceLayer)
{
message = "Map units are: '" + ArcGISTiledMapServiceLayer(layer).units + "' - the first loaded layer units";
}
else if (layer is ArcGISDynamicMapServiceLayer)
{
message = "Map units are: '" + ArcGISDynamicMapServiceLayer(layer).units + "' - the first loaded layer units";
}
Alert.show(message, "Map units");
}
}
private function getMapFirstLayer():Layer
{
if (map != null)
{
var mapLayers:ArrayCollection = map.layers as ArrayCollection;
if (mapLayers != null && mapLayers.length > 0)
{
return mapLayers.getItemAt(0) as Layer;
}
}
return null;
}
]]>
</fx:Script>
<s:Button label="Show map units" click="button1_clickHandler(event)" />
<esri:Map id="map">
<esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
</esri:Map>
</s:Application>
... View more
04-16-2012
12:27 AM
|
0
|
0
|
3338
|
|
POST
|
Your version is on: beta1 2011-12-16 Tom, you're right. I did not pay attention to it.
... View more
04-15-2012
11:16 PM
|
0
|
0
|
3338
|
|
POST
|
:confused: it's also missed in the library itself [ATTACH=CONFIG]13541[/ATTACH] test: protected function onWidgetOpen(event:Event):void
{
Alert.show("Map units are: '" + map.units + "'", "onWidgetOpen");
} [ATTACH=CONFIG]13542[/ATTACH] No comments.
... View more
04-15-2012
10:59 PM
|
0
|
0
|
3338
|
|
POST
|
Tom, yes "units" property is not in reference (I do not know why), but it is String type property and it exists: units property units:String The units of the Map. These units are used for calculating the map scale. The default value is the units of the first layer added to the map. This property can be used as the source for data binding. map.units = Units.METERS; see com.esri.ags.Units
... View more
04-15-2012
10:24 PM
|
0
|
0
|
3338
|
|
POST
|
3D web mapping is possible 1, 2, 3 - but not with current version (2.5) of ArcGIS API for Flex. Right? Have you tried to find answer here?
... View more
04-13-2012
03:03 AM
|
0
|
0
|
1086
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 12-03-2017 11:25 PM | |
| 1 | 10-06-2016 11:49 PM | |
| 2 | 06-07-2012 01:38 AM | |
| 1 | 06-03-2012 09:42 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|