|
POST
|
Yes, ArrayCollection can be created at front and be updated within the if.. else.. loop... protected function myDDL_changeHandler(event:IndexChangeEvent):void
{
var dyn:ArcGISDynamicMapServiceLayer= map.getLayer("gpsTrack") as ArcGISDynamicMapServiceLayer;
var visLayers:ArrayCollection = dyn.visibleLayers;
if (myDDL.selectedItem.subject == "Track")
{
// remove item = 2
var indexOfItemToRemove:int = visLayers.getItemIndex(2);
if (indexOfItemToRemove != -1)
{
visLayers.removeItemAt(indexOfItemToRemove);
}
// add item = 1
visLayers.addItem(1);
dyn.visibleLayers = visLayers;
dyn.refresh();
}
else if (myDDL.selectedItem.subject == "Elevation")
{
// remove item = 1
var indexOfItemToRemove:int = visLayers.getItemIndex(1);
if (indexOfItemToRemove != -1)
{
visLayers.removeItemAt(indexOfItemToRemove);
}
// add item = 2
visLayers.addItem(2);
dyn.visibleLayers = visLayers;
dyn.refresh();
}
} 1 more time, Yes, ArrayCollection can be created at front and be updated within the if.. else.. loop..., but can you answer me now, why is it needed (in your situation)? protected function myDDL_changeHandler(event:IndexChangeEvent):void
{
var dyn:ArcGISDynamicMapServiceLayer= map.getLayer("gpsTrack") as ArcGISDynamicMapServiceLayer;
if (myDDL.selectedItem.subject == "Track")
{
dyn.visibleLayers = new ArrayCollection([1]); // set collection of visible layers
dyn.refresh();
}
else if (myDDL.selectedItem.subject == "Elevation")
{
dyn.visibleLayers = new ArrayCollection([2]); // set collection of visible layers
dyn.refresh();
}
}
... View more
04-10-2012
03:55 AM
|
0
|
0
|
1340
|
|
POST
|
ann, just fill the difference: If 'someText' is not 'Bindable' property: <?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"> <s:layout> <s:VerticalLayout /> </s:layout> <fx:Script> <![CDATA[ import mx.controls.Alert; import mx.utils.StringUtil; private var someText:String = "some text"; protected function onSubmitClick(event:MouseEvent):void { someText = txtInput.text; var message:String = StringUtil.substitute("someText value = '{0}'\ntxtInput text = '{1}'\nlblOutput text = '{2}'", someText, txtInput.text, lblOutput.text); Alert.show(message); } ]]> </fx:Script> <s:TextInput id="txtInput" /> <s:Button label="Submit" click="onSubmitClick(event)" /> <s:Label id="lblOutput" text="{someText}" /> <!-- Data binding will not be able to detect assignments to "someText" ... in line 33 ... --> </s:Application> If 'someText' is 'Bindable' property: <?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"> <s:layout> <s:VerticalLayout /> </s:layout> <fx:Script> <![CDATA[ import mx.controls.Alert; import mx.utils.StringUtil; [Bindable] private var someText:String = "some text"; protected function onSubmitClick(event:MouseEvent):void { someText = txtInput.text; var message:String = StringUtil.substitute("someText value = '{0}'\ntxtInput text = '{1}'\nlblOutput text = '{2}'", someText, txtInput.text, lblOutput.text); Alert.show(message); } ]]> </fx:Script> <s:TextInput id="txtInput" /> <s:Button label="Submit" click="onSubmitClick(event)" /> <s:Label id="lblOutput" text="{someText}" /> </s:Application> If you need to know "What is data binding?" "How is it works?" take a look to adobe forums and resources. P.S. as I understand, compiler generates warnings for code in your newView, but not for code you present.
... View more
04-09-2012
11:52 PM
|
0
|
0
|
721
|
|
POST
|
Leen, Here is about 100 sublayers - in this sample i play with legend, but you can find some layer switching visibility code 2. (sources) protected function myDDL_changeHandler(event:IndexChangeEvent):void { var dyn:ArcGISDynamicMapServiceLayer= map.getLayer("gpsTrack") as ArcGISDynamicMapServiceLayer; // var visLayers:ArrayCollection = dyn.visibleLayers; if (myDDL.selectedItem.subject == "Track") { // visLayers.removeItemAt(2); var visLayers:ArrayCollection = new ArrayCollection(); visLayers.addItem(1); dyn.visibleLayers = visLayers; dyn.refresh(); } else if (myDDL.selectedItem.subject == "Elevation") { // visLayers.removeItemAt(1); var visLayers:ArrayCollection = new ArrayCollection(); visLayers.addItem(2); dyn.visibleLayers=visLayers; dyn.refresh(); } } you can't remove item at 100, if your collection length is 50! somearraycollection.removeItemAt(item index); to check item exists you need to get its index: var itemIndex:int = somearraycollection.getItemIndex(item); so, if itemIndex not equals "-1" means what item exists, you can remove existing item: somearraycollection.removeItemAt(itemIndex);
... View more
04-09-2012
10:02 PM
|
0
|
0
|
1340
|
|
POST
|
TIDDARINE, ... I want create Flex Widget ... Creating widgets ... draw query results in the map as chart ... Query result as charts if (You've tried it) {
Show plan;
Show code;
Show problem place;
Ask quetions;
} else if (You're waiting for the code to copy and paste) {
Charity - is a rarity;
} Good luck.
... View more
04-09-2012
12:18 AM
|
0
|
0
|
1444
|
|
POST
|
Samples I linked to you are samples for ArcGIS API for FLEX - so all links to skins, layers classes, other resources ... in samples are links to files included to API [ATTACH=CONFIG]13328[/ATTACH] if you read carefully notation in sample: <!-- @@includeFiles com/esri/ags/samples/WMTSLayer.as - not a namespace! what is it? This sample shows how to add a Web Map Tile Service(WMTS) as a custom layer. The ArcGIS API for Flex allows for extending the API to access layer types not included as part of the API. In this example, tiled layers (TiledMapServiceLayer) is extended to access WMTS tiles. Steps involved: 1. Creating new ActionScript class(WMTSLayer.as) that extends TiledMapServiceLayer. 2. Hardcoding some of the configuration settings: fullExtent, initialExtent, spatialReference, tileInfo, and units. 3. Overriding the protected function getTileURL() to obtain the appropriate tiles and place them accurately on the map. 4. Using the extended class with MXML or ActionScript 🙂 -->
... View more
04-08-2012
04:34 AM
|
0
|
0
|
1358
|
|
POST
|
Chenfeng, I searched through out the web and help files, no actual working sample using WMTSLayer ... WMTS sample - ArcGIS API for FLEX 3.0 (beta) WMTS sample - ArcGIS API for FLEX 2.5 (last release)
... View more
04-07-2012
09:19 PM
|
0
|
0
|
1358
|
|
POST
|
Luke, I'm not sure, but http://services.arcgisonline.com/ArcGIS/SDK/REST/export.html dpi Description: The device resolution of the exported image (dots per inch). If the dpi is not specified, an image with a default DPI of 96 will be exported. Example: dpi=200 We tried to discuss here about it.
... View more
04-04-2012
10:19 AM
|
0
|
0
|
584
|
|
POST
|
Thomas, private const ADDRESS_FROM_LOCATION:uint = 0x1; private const ADDRESS_TO_LOCATION: uint = 0x2; private function findNearestAddress(location:MapPoint, distance:Number):void { var token:Object = { type: ADDRESS_FROM_LOCATION }; locateTask.locationToAddress(location, distance, new AsyncResponder(onLocateTaskResult, onLocateTaskFault, token)); } private function executeLocatorTask(address:String):void { // search attributes { Attribute1: "attribute value", Attribute2: "attribute value"} // defined in/by geocode service as request parameters var token:Object = { type: ADDRESS_TO_LOCATION }; var addressObj:Object = { StreetName: address }; var outFields:Array = [ "*" ]; locateTask.outSpatialReference = map.spatialReference; locateTask.addressToLocations(addressObj, outFields, new AsyncResponder(onLocateTaskResult, onLocateTaskFault, token)); } protected function onLocateTaskResult(result:*, token:Object = null):void { var candidates:Array = null; var addressCandidate:AddressCandidate = null; if (result is Array) { candidates = result as Array; } else if (result is AddressCandidate) { addressCandidate = result as AddressCandidate; } if (token != null && token.type != null) { switch (token.type) { case ADDRESS_TO_LOCATION: { var bestCandidates:Array = findBestScoredCandidates(candidates); var suitableCandidates:Array = findSuitableCandidates(candidates, 80); break; } case ADDRESS_FROM_LOCATION: { showCandidateOnMap(addressCandidate); break; } } } } protected function onLocateTaskFault(info:Object, token:Object = null):void { trace(StringUtil.substitute("Error\n>>>\n{0}", info.toString())); } private function showCandidateOnMap(candidate:AddressCandidate):void { myGraphicsLayer.clear(); // var address:Object = candidate.address; var candidateMapPoint:MapPoint = candidate.location; if (candidateMapPoint.spatialReference.wkid != myMap.spatialReference.wkid) { candidateMapPoint = WebMercatorUtil.geographicToWebMercator(candidate.location) as MapPoint; } var myGraphic:Graphic = new Graphic(candidateMapPoint, mySymbol, address); myGraphic.toolTip = address.Address.toString(); myGraphicsLayer.add(myGraphic); } private function findBestScoredCandidates(candidates:Array):Array { if (candidates != null) { if (candidates.length > 0) { var bestScore:Number = 0; var bestScoredCandidates:Array = new Array(); for (var index:int; index < candidates.length; index++) { var nextCandidate:AddressCandidate = candidates[index]; if (nextCandidate.score > bestScore) // candidate with better score found { bestScoredCandidates = new Array(); bestScoredCandidates.push(nextCandidate); bestScore = nextCandidate.score; } else if (nextCandidate.score > bestScore) // candidate with same score found { bestScoredCandidates.push(nextCandidate); } } return bestScoredCandidates; } } return null; } private function findSuitableCandidates(candidates:Array, suitableScore:Number):Array { if (candidates != null) { if (candidates.length > 0) { var suiatableCandidates:Array = new Array(); for (var index:int; index < candidates.length; index++) { var nextCandidate:AddressCandidate = candidates[index]; if (nextCandidate.score >= suitableScore) { suiatableCandidates.push(nextCandidate); } } return suiatableCandidates; } } return null; } Also, as I remember Location Service has alot of configurations on server side, so you can try sort, filter ... results on server.
... View more
04-04-2012
03:30 AM
|
0
|
0
|
976
|
|
POST
|
Luis, I think, yes - it is possible. ImageService The image service resource supports the following operations: Export Image: Returns a seamless mosaicked image for the specified area. Identify (added at 10): Identifies the content of an image service. Query (added at 10): Query the image service. Download (added at 10): Downloads raw raster files. ImageServiceIdentifyTask Since : ArcGIS API for Flex 2.0 Performs an identify operation on an image service resource. It identifies the content of an image service for a given location and a given mosaic rule. The location can be a point or a polygon. The identify operation is supported by all kinds of image services (Mosaic Datasets, Raster Datasets or an Image Service definition). QueryTask ... For image services, the map service itself is the 'single' layer... Did you tried to make query/identify? Do you have access to ESRI help page? Do you have access to ArcGIS API for FLEX reference?
... View more
04-02-2012
08:29 PM
|
0
|
0
|
583
|
|
POST
|
Brian, setExtent(Geometry geometry) This method will zoom map into the given geometry and use its bound as current map extent.
... View more
04-02-2012
12:04 PM
|
0
|
0
|
1098
|
|
POST
|
Tarak, Flex API - is an interface, Application Programming Interface Are you talking about UI - User Interface? Each sample ("This code gallery is a view of user-contributed code samples") written by some developer. You need to contact the developer of an example, an interface that you want to resuse. For example: This written by Frank, This written by Robert.
... View more
04-02-2012
07:55 AM
|
0
|
0
|
806
|
|
POST
|
ihdasilva, no, it is not possible. (The only way, if you initialize each sub layer as ArcGISDynamicMapServiceLayer :rolleyes: ) Here is important to understand how is it works. 1 - ArcGISDynamicMapServiceLayer is container for IMAGE exported from server, parameters you set for ArcGISDynamicMapServiceLayer are IMAGE export parameters. Not 55 images for 55 sublayers, but 1 image exported form server for 55 sublayers. 2 - Flex Map is container for all layers: static layer (navigation, scalebar, copyright, logo ...), map layers (each 1 is something like flex display object / container )) The transparency you set for ArcGISDynamicMapServiceLayer is alpha parameter for flex component (for IMAGE - 1 image for 55 sublayers) Right? Look at this discussion. May be you do not need to change transparency in flex code, but you set layers transparency in mxd file.
... View more
03-28-2012
03:29 AM
|
0
|
0
|
2097
|
|
POST
|
Radek, Working with coordinates (copy, convert, project ...). You can specify either an extent or a center point with a map scale or specific zoom level.
... View more
03-28-2012
12:40 AM
|
0
|
0
|
1201
|
| 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
|